CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Cannot redeclare class HTMLPurifier_Bootstrap
Pages: [1]

Author Topic: Cannot redeclare class HTMLPurifier_Bootstrap  (Read 1500 times)

Stijn | Yichalal

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.3
  • CMS version: Drupal 7
  • MySQL version: MySQL version 5.1.66
  • PHP version: 5.3.3-7+squeeze15
Cannot redeclare class HTMLPurifier_Bootstrap
April 18, 2013, 06:32:22 am
After upgrade from 4.2.6 to 4.3 I got an error 500 Internal Server Error in Drupal 7.22.
The errors I got in the Apache logs was :
Code: [Select]
PHP Fatal error:  Cannot redeclare class HTMLPurifier_Bootstrap in /public/sites/all/libraries/htmlpurifier/library/HTMLPurifier/Bootstrap.php on line 31. I solved it by disabling HTMLpurifier module in Drupal, but of course this is not meant to be like this.
Any thoughts?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Cannot redeclare class HTMLPurifier_Bootstrap
April 18, 2013, 06:44:28 am

yes there is a conflict between the html purifier civi uses vs the one packaged with the drupal module

we tried to fix it without success and had to give up :(

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Stijn | Yichalal

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.3
  • CMS version: Drupal 7
  • MySQL version: MySQL version 5.1.66
  • PHP version: 5.3.3-7+squeeze15
Re: Cannot redeclare class HTMLPurifier_Bootstrap
April 18, 2013, 11:41:15 am
Donald, thanks for prompt reply. I appreciate that very much and have a lot of respect for what you do.
Still I find it very strange that this kind of conflict with a not so exotic module (usage of 8270 according to drupal.org) does not even get mentioned in release notes or did I miss something?

Anyway, even more strange is that also the previous release had HTMLpurifier on board and no conflict there.

I suppose that if you have tried debugging this, it doesn't make sense a noob like me would try to do what you failed at. If I can help with anything...

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Cannot redeclare class HTMLPurifier_Bootstrap
April 18, 2013, 12:27:52 pm

We dont have a compatibility list of civi with various drupal modules, but is probably a good idea to start one.

Can you please do the needful on the CiviCRM wiki, maybe as a child page of the drupal install/upgrade pages

We had issues getting the same code to work under joomla and drupal. getting it fixed for drupal only was not too bad. However based on weighting etc, you probably also need to patch the htmlpurifier module

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

ktmom

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: Cannot redeclare class HTMLPurifier_Bootstrap
April 30, 2013, 06:36:59 am
I had this problem also.  I'm new to CiviCRM but have some experience with Drupal. Since my coding is self taught, I'm not sure that this is an acceptable solution, but I was able to keep my Drupal HTML Purifier module turned on and disable the autoload of CiviCRM's by modifying the following code in ClassLoader.php;

line 74:
    // we do this to prevent a autoloader errors with joomla / 3rd party packages
    // use absolute path since we dont know the content of include_path as yet
    // CRM-11304

    // since HTML Purifier could potentially be loaded / used by other modules / components
    // lets check it its already loaded
    // we also check if the bootstrap file exists since during install of a drupal distro profile
    // the files might not exists, in which case we skip loading the file
    // if you change the below, please test on Joomla and also PCP pages
    $includeHTMLPurifier = TRUE;
    $htmlPurifierPath = dirname(__FILE__) . '/../../packages/IDS/vendors/htmlpurifier/HTMLPurifier/Bootstrap.php';
->$drupal_HTMLPurifier = (module_exists('htmlpurifier')) ? TRUE : FALSE; // uses a drupal module check for available and enabled
    if (
      class_exists('HTMLPurifier_Bootstrap') ||
      !file_exists($htmlPurifierPath) ||
->  $drupal_HTMLPurifier
    ) {
      $includeHTMLPurifier = FALSE;
    }
    else {
      require_once $htmlPurifierPath;
    }

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Cannot redeclare class HTMLPurifier_Bootstrap
June 10, 2014, 03:19:04 pm
For reference (just ran into this testing a site upgrade).

https://issues.civicrm.org/jira/browse/CRM-11966 / https://github.com/civicrm/civicrm-core/pull/3437

Fix is in that issue (will be in 4.5).
@xurizaemon ● www.fuzion.co.nz

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Cannot redeclare class HTMLPurifier_Bootstrap

This forum was archived on 2017-11-26.