• Resolved don_alejandro

    (@don_alejandro)


    Updating to the recent version broke two websites I manage. I duplicated the error on my development server – here is the error message:

    Fatal error: Cannot declare class HTMLPurifier_Bootstrap, because the name is already in use in C:\Users\Don\Documents\webs\OVEC_New\blog\wp-content\plugins\ml-slider\assets\htmlpurifier\library\HTMLPurifier\Bootstrap.php on line 30

    Re-installing 3.17.1 fixed it for now.

    CiviCRM apparently uses the same class name, as MetaSlider does not crash if I disable CiviCRM. I suspect MetaSlider threw the error because CiviCRM loaded first. I’ll mention this on a CiviCRM forum too, in case they want to use a more unique class name.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @don_alejandro

    Can you send me the URL to their plugin or theme so I can take a look?

    You can also just bypass that code using the “metaslider_filter_unsafe_html” filter to disable the whole thing. Just return false (and monitor the html in your captions).

    Also, if you want to navigate to ml-slider/inc/slide/metaslide.image.class.php, you can update the function to the following:

    if (apply_filters('metaslider_filter_unsafe_html', true) && $slide['caption']) {
        try {
            if (!class_exists('HTMLPurifier')) {
                require_once(METASLIDER_PATH . 'assets/htmlpurifier/library/HTMLPurifier.auto.php');
            }
            $purifier = new HTMLPurifier();
            $slide['caption'] = $purifier->purify($slide['caption']);
        } catch (Exception $e) {
            // If something goes wrong then escape
            $slide['caption'] = htmlspecialchars(do_shortcode($caption), ENT_NOQUOTES, 'UTF-8');
        }
    }

    Specifically note the if (!class_exists('HTMLPurifier')) { part. I’ll add this to the next release so it’s safe to edit it and update later on.

    Thread Starter don_alejandro

    (@don_alejandro)

    CiviCRM a fairly massive constituency relationship management (CRM) system that runs on various content management systems, including WordPress.

    https://civicrm.org/

    Various downloads are here: https://civicrm.org/download

    Thread Starter don_alejandro

    (@don_alejandro)

    Thanks – that looks like a good solution

    Did adding the class_exists check work? I can release it now if so.

    Please fix this if your changes work. I have disabled Metaslider until there is a fix and don’t want to muddle with this unless I absolutely have to. I am using CiviCRM too and yes the whole site crashed with the error “There has been a critical error on your website.”

    Thread Starter don_alejandro

    (@don_alejandro)

    Yes – I just added the if clause on my development server and it works okay.

    Thanks @don_alejandro and @rmniemela for the feedback. The fix is in 3.17.4 if you want to update. Let me know if you see any more issues!

    I’ll mark this resolved but feel free comment if something is still off

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘3.17.2 update crashes sites running CiviCRM’ is closed to new replies.