• Resolved jckuffner

    (@jckuffner)


    Is the plugin php 8 ready? I’m getting this error when upgrading to php 8 on WP Engine:

    PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /wp-content/plugins/advanced-backgrounds/classes/class-vc-extend.php:121

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Nikita

    (@nko)

    Hey.

    Unfortunately, I don’t see such an error on the test server. If you can provide more information on how to reproduce it, it will be helpful.

    Regards, nK.

    Thread Starter jckuffner

    (@jckuffner)

    Thanks for your response. I will do some more testing and let you know what I find.

    Thread Starter jckuffner

    (@jckuffner)

    Here is the full message I get on the server:

    Message:
    PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /nas/content/live//wp-content/plugins/advanced-backgrounds/classes/class-vc-extend.php:121\nStack trace:\n#0 /nas/content/live//wp-includes/class-wp-hook.php(309): NK_AWB_VC_Extend->vc_shortcode_output_filter(‘<div class=”vc_…’, Object(US_Shortcodes), ”)\n#1 /nas/content/live//wp-includes/plugin.php(189): WP_Hook->apply_filters(‘<div class=”vc_…’, Array)\n#2 /nas/content/live//wp-content/plugins/us-core/functions/shortcodes.php(259): apply_filters(‘vc_shortcode_ou…’, ‘<div class=”vc_…’, Object(US_Shortcodes), ”, ‘vc_column’)\n#3 /nas/content/live//wp-includes/shortcodes.php(356): US_Shortcodes->__call(‘vc_column’, Array)\n#4 [internal function]: do_shortcode_tag(Array)\n#5 /nas/content/live//wp-includes/shortcodes.php(228): preg_replace_callback(‘/\\\\[(\\\\[?)(vc_col…’, ‘do_shortcode_ta…’, ‘[vc_column][/vc…’)\n#6 /nas/content/live//wp-content/plugins/us-core/templates/elements/vc_row.php(494): do_shortcode(‘[vc_column][/vc…’)\n#7 /nas/content/live//wp-content/plugins/us-core/functions/shortcodes.php(245): require(‘/nas/content/li…’)\n#8 /nas/content/live//wp-includes/shortcodes.php(356): US_Shortcodes->__call(‘vc_row’, Array)\n#9 [internal function]: do_shortcode_tag(Array)\n#10 /nas/content/live//wp-includes/shortcodes.php(228): preg_replace_callback(‘/\\\\[(\\\\[?)(vc_row…’, ‘do_shortcode_ta…’, ‘[vc_row height=…’)\n#11 /nas/content/live//wp-includes/class-wp-hook.php(307): do_shortcode(‘[vc_row height=…’)\n#12 /nas/content/live//wp-includes/plugin.php(189): WP_Hook->apply_filters(‘[vc_row height=…’, Array)\n#13 /nas/content/live//wp-content/plugins/us-core/templates/single.php(45): apply_filters(‘the_content’, ‘<p>[vc_row heig…’)\n#14 /nas/content/live//wp-content/plugins/us-core/functions/helpers.php(142): include(‘/nas/content/li…’)\n#15 /nas/content/live//wp-content/themes/Zephyr/page.php(12): us_load_template(‘templates/singl…’)\n#16 /nas/content/live//wp-includes/template-loader.php(106): include(‘/nas/content/li…’)\n#17 /nas/content/live//wp-blog-header.php(19): require_once(‘/nas/content/li…’)\n#18 /nas/content/live//index.php(17): require(‘/nas/content/li…’)\n#19 {main}\n thrown in /nas/content/live//wp-content/plugins/advanced-backgrounds/classes/class-vc-extend.php on line 121

    I managed to create a workaround by adding declarations to vc_shortcode_output_filter. It seems that since upgrading to php8 $attr does not always arrive as an array. This is what I wrote:

    public function vc_shortcode_output_filter( $output, $obj, $attr ) {
            if ( is_array($attr) ):
                $attr += ['awb_after_vc_row' => 'false'];
            else:
                $attr = array('awb_after_vc_row' => 'false');
            endif;
            if ( $obj->settings( 'base' ) === 'vc_row' ) {
                $attr['awb_after_vc_row'] = 'true';
                $output                  .= NK_AWB_Shortcode::get_shortcode_out( $attr, '' );
            } elseif ( $obj->settings( 'base' ) === 'vc_column' ) {
                $attr['awb_after_vc_column'] = 'true';
                $output                     .= NK_AWB_Shortcode::get_shortcode_out( $attr, '' );
            }
            return $output;
        }

    Hope this helps.

    Plugin Author Nikita

    (@nko)

    Hey.

    Can you re-test it on a fresh installation without 3rd-party plugins and with a standard Twenty theme? Make sure you use the latest WPBakery version (6.8.0).

    I have checked the code of WPBakery and they are always returning an array for this attribute. The only reason may be in the wrong filtering (maybe from a 3rd-party plugin).

    In case you still will see an error, can you export your page shortcodes from content, I want to look at them locally.

    Regards, nK.

    Thread Starter jckuffner

    (@jckuffner)

    I would think the error is coming via https://help.us-themes.com/impreza/us-core/ – see “/plugins/us-core/” in the error log. It’s a commercial plugin to support Zephyr & Impreza VC themes. I’m sure I won’t see an error if I install AWB on a fresh WP copy.

    Plugin Author Nikita

    (@nko)

    If this really comes from their code, they definitely should fix it. Just let them know.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘php 8’ is closed to new replies.