• I’m trying to upgrade our server from PHP 7.3 to 8.0, which treats what used to be warnings as errors. The error I’m getting is

    Fatal error: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /var/app/current/wp-content/plugins/embed-any-document/awsm-embed.php:179

    This is when I edit a page. I believe it has some interplay with the plugin Advanced Custom Fields. The particular page uses a block that contains a ACF repeater, of which inside contains ACF Image (it’s a slideshow block that we created).

    I believe it’s because at here
    $screen = get_current_screen();
    It will return a null sometimes, so method_exists( $screen, ‘is_block_editor’ ) will barf. Simplest fix would be to check for null before doing method_exists()

    The full stack trace is below

    Stack Trace
    1.	
    method_exists(NULL, 'is_block_editor')
    /var/app/current/wp-content/plugins/embed-any-document/awsm-embed.php:179
    2.	
    Awsm_embed->embed_helper('')
    /var/app/current/wp-includes/class-wp-hook.php:292
    3.	
    WP_Hook->apply_filters('', Array)
    /var/app/current/wp-includes/class-wp-hook.php:316
    4.	
    WP_Hook->do_action(Array)
    /var/app/current/wp-includes/plugin.php:484
    5.	
    do_action('wp_enqueue_medi...')
    /var/app/current/wp-includes/media.php:4537
    6.	
    wp_enqueue_media()
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/assets.php:301
    7.	
    ACF_Assets->enqueue_uploader()
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/assets.php:603
    8.	
    acf_enqueue_uploader()
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-link.php:104
    9.	
    acf_field_link->render_field(Array)
    /var/app/current/wp-includes/class-wp-hook.php:292
    10.	
    WP_Hook->apply_filters('', Array)
    /var/app/current/wp-includes/class-wp-hook.php:316
    11.	
    WP_Hook->do_action(Array)
    /var/app/current/wp-includes/plugin.php:551
    12.	
    do_action_ref_array('acf/render_fiel...', Array)
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:105
    13.	
    _acf_apply_hook_variations(Array)
    /var/app/current/wp-includes/class-wp-hook.php:292
    14.	
    WP_Hook->apply_filters('', Array)
    /var/app/current/wp-includes/class-wp-hook.php:316
    15.	
    WP_Hook->do_action(Array)
    /var/app/current/wp-includes/plugin.php:484
    16.	
    do_action('acf/render_fiel...', Array)
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:784
    17.	
    acf_render_field(Array)
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:744
    18.	
    acf_render_field_wrap(Array, 'div')
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-repeater.php:330
    19.	
    acf_field_repeater->render_field(Array)
    /var/app/current/wp-includes/class-wp-hook.php:292
    20.	
    WP_Hook->apply_filters('', Array)
    /var/app/current/wp-includes/class-wp-hook.php:316
    21.	
    WP_Hook->do_action(Array)
    /var/app/current/wp-includes/plugin.php:551
    22.	
    do_action_ref_array('acf/render_fiel...', Array)
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/acf-hook-functions.php:105
    23.	
    _acf_apply_hook_variations(Array)
    /var/app/current/wp-includes/class-wp-hook.php:292
    24.	
    WP_Hook->apply_filters('', Array)
    /var/app/current/wp-includes/class-wp-hook.php:316
    25.	
    WP_Hook->do_action(Array)
    /var/app/current/wp-includes/plugin.php:484
    26.	
    do_action('acf/render_fiel...', Array)
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:784
    27.	
    acf_render_field(Array)
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:744
    28.	
    acf_render_field_wrap(Array, 'div', 'field')
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:603
    29.	
    acf_render_fields(Array, 'block_609170948...', 'div', 'field')
    /var/app/current/wp-content/plugins/advanced-custom-fields-pro/pro/blocks.php:594
    30.	
    acf_ajax_fetch_block('')
    /var/app/current/wp-includes/class-wp-hook.php:292
    31.	
    WP_Hook->apply_filters('', Array)
    /var/app/current/wp-includes/class-wp-hook.php:316
    32.	
    WP_Hook->do_action(Array)
    /var/app/current/wp-includes/plugin.php:484
    33.	
    do_action('wp_ajax_acf/aja...')
    /var/app/current/wp-admin/admin-ajax.php:187
    34.	
    {main}
    thrown in /var/app/current/wp-content/plugins/embed-any-document/awsm-embed.php on line 179
  • The topic ‘Upgrading PHP 7.3 to 8.0’ is closed to new replies.