Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • sbefort

    (@sbefort)

    It appears that the issue has been fixed in version 2.4.7 of cookie-notice:

    $ find cookie-notice.2.4.7/ -type f -exec grep wp_is_json_request {} /dev/null \;
    cookie-notice.2.4.7/includes/frontend.php: return isset( $_GET[‘cn_preview_mode’] ) || is_preview() || is_customize_preview() || defined( ‘IFRAME_REQUEST’ ) || ( function_exists( ‘wp_is_json_request’ ) && wp_is_json_request() ) || apply_filters( ‘cn_is_preview_mode’, false );

    I’ve installed version 2.4.7 on my wordpress server (version 4.8.21) and the issue is not seen anymore.

    Thanks a lot for providing the fix.

    Stephan

    Same thing also happened to me.

    In file error.log I’m finding lots of error messages like

    PHP Fatal error: Uncaught Error: Call to undefined function wp_is_json_request() in …/wp-content/plugins/cookie-notice/includes/frontend.php:33
    Stack trace:
    #0 …/wp-content/plugins/cookie-notice/includes/frontend.php(52): Cookie_Notice_Frontend->is_preview_mode()
    #1 …/wp-includes/class-wp-hook.php(298): Cookie_Notice_Frontend->init(”)
    #2 …/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)
    #3 …/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #4 …/wp-settings.php(448): do_action(‘init’)
    #5 …/wp-config.php(66): require_once(‘…’)
    #6 …/wp-load.php(37): require_once(‘…’)
    #7 …/wp-cron.php(26): require_once(‘…’)
    #8 {main}\n thrown in …/wp-content/plugins/cookie-notice/includes/frontend.php on line 33, referer: https://…/wp-cron.php?doing_wp_cron=1674169925.9840281009674072265625

    It seems that version 2.4.5 is making use of function wp_is_json_request() which version 2.4.4 didn’t:

    $ find cookie-notice.2.4.4/ -type f -exec grep wp_is_json_request {} /dev/null \;
    $ find cookie-notice.2.4.5/ -type f -exec grep wp_is_json_request {} /dev/null \;
    cookie-notice.2.4.5/includes/frontend.php: return isset( $_GET[‘cn_preview_mode’] ) || is_preview() || is_customize_preview() || defined( ‘IFRAME_REQUEST’ ) || wp_is_json_request() || apply_filters( ‘cn_is_preview_mode’, false );

    From looking at the reference page of function wp_is_json_request() at https://developer.www.ads-software.com/reference/functions/wp_is_json_request/it seems that this function was introduced in version 5.0.0 of wordpress while I’m running version 4.8.21.

    Going back to plugin version 2.4.4 resolved the issue, so it seems that version 2.4.5 might not be compatible with wordpress version 4.x any more.

Viewing 2 replies - 1 through 2 (of 2 total)