• Resolved AiratTop

    (@airathalitov)


    Hi!

    After update Yoast SEO to v10.0 I see a lot of this warnings in logs:

    PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /site_path/wp-includes/class-wp-hook.php on line 286

    Code:

    // Avoid the array_slice if possible.
    if ( $the_['accepted_args'] == 0 ) {
        $value = call_user_func_array( $the_['function'], array() );
    } elseif ( $the_['accepted_args'] >= $num_args ) {
        $value = call_user_func_array( $the_['function'], $args );
    } else {
        $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
    }

    Yoast SEO v10.0
    WordPress 5.1.0 and 5.1.1
    PHP 7.2.16-1+ubuntu16.04.1+deb.sury.org+1

Viewing 8 replies - 1 through 8 (of 8 total)
  • It’s possible if function (which is callback for add_filter or https://developer.ww.wp.xz.cn/reference/functions/add_action/) doesn’t exist.

    You should try to flush OPcache and it’s helpful to enable Xdebug (or other solution) to get debug trace (you will see in which filter is an issue).

    Thread Starter AiratTop

    (@airathalitov)

    I don’t use OPcache

    This is my WP_DEBUG mode settings:

    /** Enable WP_DEBUG mode */
    define( 'WP_DEBUG', true );
    
    if ( WP_DEBUG ) {
        @error_reporting( E_ALL );
        @ini_set( 'log_errors', true );
        @ini_set( 'log_errors_max_len', '0' );
    
        define( 'WP_DEBUG_LOG', true );
        define( 'WP_DEBUG_DISPLAY', false );
        @ini_set( 'display_errors', 0 );
        define( 'CONCATENATE_SCRIPTS', false );
        define( 'SAVEQUERIES', true );
        define( 'SCRIPT_DEBUG', false );
    }

    But I don’t see any stack trace. Just this line:

    PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /site_path/wp-includes/class-wp-hook.php on line 286

    This gist will explain how to enable the backtrace in your website: https://gist.github.com/jrfnl/5925642

    Thread Starter AiratTop

    (@airathalitov)

    As I said here is wordpress-seo (Yoast SEO) plugin in Backtrace:

    [13-Mar-2019 14:06:25 UTC] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /site_path/wp-includes/class-wp-hook.php on line 286
    [13-Mar-2019 14:06:26 UTC] Backtrace from warning 'call_user_func_array() expects parameter 1 to be a valid callback, no array or string given' at /site_path/wp-includes/class-wp-hook.php 286: /site_path/wp-includes/plugin.php 208 calling apply_filters() | /site_path/wp-content/plugins/wordpress-seo/frontend/class-remove-reply-to-com.php 81 calling apply_filters() | /site_path/wp-content/plugins/wordpress-seo/frontend/class-remove-reply-to-com.php 23 calling clean_reply_to_com() | /site_path/wp-content/plugins/wordpress-seo/frontend/class-frontend.php 151 calling register_hooks() | /site_path/wp-content/plugins/wordpress-seo/frontend/class-frontend.php 198 calling __construct() | /site_path/wp-content/plugins/wordpress-seo/inc/wpseo-functions.php 19 calling get_instance() | /site_path/wp-includes/class-wp-hook.php 286 calling initialize_wpseo_front() | /site_path/wp-includes/class-wp-hook.php 310 calling apply_filters() | /site_path/wp-includes/plugin.php 465 calling do_action() | /site_path/wp-settings.php 505 calling do_action() | /site_path/wp-config.php 210 calling require_once() | /site_path/wp-load.php 37 calling require_once() | /site_path/wp-blog-header.php 13 calling require_once() | /site_path/index.php 17 calling require()
    Thread Starter AiratTop

    (@airathalitov)

    Thread Starter AiratTop

    (@airathalitov)

    Solution:
    Add to theme functions.php file:

    add_filter( 'wpseo_remove_reply_to_com', '__return_false' );

    instead of
    add_filter( 'wpseo_remove_reply_to_com', false );

    Related:
    https://ww.wp.xz.cn/support/topic/readers-cant-answer-comments/
    https://ww.wp.xz.cn/support/topic/replytocom-removal-breaks-wp-touch-pro-nested-comments/#post-10072157

    • This reply was modified 7 years, 2 months ago by AiratTop.

    @airathalitov Could you mark this topic as resolved please ?

    Thread Starter AiratTop

    (@airathalitov)

    Done
    Thanks!

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

The topic ‘PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback’ is closed to new replies.