• Resolved videomike

    (@videomike)


    I seem to run into a compatibility issue, this is what I see in the error log.

    PHP message: PHP Fatal error: Cannot redeclare mb_ord() (previously declared in /pathtowordpress/htdocs/wp-content/plugins/email-encoder-premium/includes/compat.php:23) in /pathtowordpress/htdocs/wp-content/plugins/erp/vendor/symfony/polyfill-mbstring/bootstrap.php on line 55″

    A look into line 55 shows that there is a check for mb_chr
    if (!function_exists(‘mb_chr’))

    but no check for mb_ord and mb_scrub.
    As a quick solution I added checks for those, but it would be nice if this could be addressed in the next update.

    kind regards

    Michael Busch-Hewera

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello @videomike

    It’s really tough for us to make WPERP compatible with all the plugins out there. The plugin you mentioned is a paid plugin, so, it’s not possible for us to check it and make WPERP compatible with it at this moment.

    However, As WPERP is free and the ’email-encoder-premium’ team can test it easily, you can also try reaching them. I hope they will help ??

    Also, we’ll keep it as a note for future enhancement.

    Thanks

    Thread Starter videomike

    (@videomike)

    Hello @thebengalboy

    Thanks for your quick response. I know the pain of trying to make plugins compatible. And I am fully aware that it is simple not possible to test you plugin with every combination of other plugins.
    Nevertheless in this case it is very easy to make your plugin compatible (maybe also with a lot of other plugins that I don’t even know of if you change a few lines of code:
    If you have a look at line 55 of /wp-content/plugins/erp/vendor/symfony/polyfill-mbstring/bootstrap.php , and change it to the following:

    if (!function_exists(‘mb_ord’)) {
    function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
    }
    if (!function_exists(‘mb_chr’)) {
    function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
    }
    if (!function_exists(‘mb_scrub’)) {
    function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
    }

    This will make it compatible (and by the way is what I did to solve the problem for now.)

    Cheers

    Mike

    P.S:I also checked the code in the email encoder plugin:
    if ( ! function_exists( ‘mb_ord’ ) ) :

    function mb_ord( $string ) {
    if ( extension_loaded( ‘mbstring’ ) === true ) {
    mb_language( ‘Neutral’ );
    mb_internal_encoding( ‘UTF-8’ );
    mb_detect_order( [ ‘UTF-8’, ‘ISO-8859-15’, ‘ISO-8859-1’, ‘ASCII’ ] );

    $result = unpack( ‘N’, mb_convert_encoding( $string, ‘UCS-4BE’, ‘UTF-8’ ) );

    if ( is_array( $result ) === true ) {
    return $result[ 1 ];
    }
    }

    return ord( $string );
    }

    They do check for the existence of mb_ord before introducing the function, so they do it absolutely correctly – there is no way for them to make it compatible, the needed changes are in /wp-content/plugins/erp/vendor/symfony/polyfill-mbstring/bootstrap.php …

    • This reply was modified 4 years, 12 months ago by videomike.

    Hello @videomike

    We are not considering to make WPERP compatible with the paid plugin you mentioned at this moment but surely your shared solution will help the other peoples who are in the same situation.

    Thanks

    Thread Starter videomike

    (@videomike)

    Hi @thebengalboy

    No worries, the solution works fine for me now.
    I would just ask you to remember this when the next update of the plugin is planned. I had this solution in place about a month ago and when the last update for WPERP came 3 weeks ago, it killed my website. I just want to make sure this does not happen again…

    Thanks in advance

    Mike

    Thread Starter videomike

    (@videomike)

    Sigh – now exactly what I wanted to avoid happened again.
    Today the latest Update of the plugin was released and … my site was broken again.

    Please change the lines 54 and following of /erp/vendor/symfony/polyfill-mbstring/bootstrap.php to

    if (!function_exists(‘mb_ord’)) {
    function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
    }
    if (!function_exists(‘mb_chr’)) {
    function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc);}
    }
    if (!function_exists(‘mb_scrub’)) {
    function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
    }

    Then WP ERP will not break sites after every update.

    Hello @videomike

    I’m afraid that it’ll not be possible to change anything under the ../erp/vendor/ folder as they are basically libraries we used.

    mbstring is a non-default extension actually. This means it is not enabled by default. You must explicitly enable the module with the configure option.

    I’m not sure but you might face the problem for something else. If you can contact our support center, we may find any other/ a permanent solution especially for you.

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘incompatibility with email-encoder-premium’ is closed to new replies.