• Hi just wanted to flag that, the plugin probably doesn’t work with php8.x

    Just updated the site to php8.x, the option forms are not loading in the admin dashbaord.

    Error details
    Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in wp-content/plugins/campaign-monitor-wp/includes/classes/k/k.php on line 409

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support gavinohanlon

    (@gavinohanlon)

    Hi iugoau,

    Thanks for reaching out and letting us know about this. I will certainly pass this on to the development team.

    If you encounter any other issues, don’t hesitate to let us know.

    All the best.

    reynir1

    (@reynir1)

    php 8.0 or 8.1 compatible
    `Hi just wanted to flag that, the plugin doesn’t work with php8.x

    Just updated the site to php8.1, the option forms are not loading in the admin dashbaord or on the frontend.

    Error details
    …/wp-content/plugins/campaign-monitor-wp/providers/campaignmonitor/campaignmonitor/class/services_json.php. Error message: Array and string offset access syntax with curly braces is no longer supported

    I opened the file: service_json.php and replaced all curly braces ‘{‘ with square brackets ‘[‘ according to help I found on the internet:
    “Since PHP 7.4 curly braces method to get individual characters inside a string has been deprecated”
    My page seems to work both on the backend and frontend with this modification, but it would be highly appreciated and big help for many users using the Optin Plugin.

    Thread Starter iugoau

    (@iugoau)

    Howdy,

    Further to the above, it looks like the plugin should probably be using the WP provided JSON class instead? The plugin’s class seems to be a copy from an older version of WP.

    In campaign-monitor-wp/providers/campaignmonitor/campaignmonitor/class/serialisation.php:

    Instead of –

    if (!class_exists('Services_JSON', false)) {
        require_once dirname(__FILE__).'/services_json.php';
    }

    It could be –

    if ( ! class_exists( 'Services_JSON' ) ) {
        require_once ABSPATH . '/wp-includes/class-json.php';
    }

    (This whole class is actually marked deprecated since WP 5.3.0 in favour of the built-in PHP functions, json_encode and json_decode.)

    A developer could optionally circumvent the Array and string offset access syntax with curly braces is no longer supported error by adding the following to a custom plugin (or a must use plugin):

    $class_file = ABSPATH . '/wp-includes/class-json.php';
    if ( file_exists( $class_file ) ) {
    	require_once $class_file;
    }

    This would ensure that WP’s version of the class is always loaded instead (though it might trigger a bunch of WP deprecation notices)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php 8.0 or 8.1 compatible’ is closed to new replies.