Ecommerce Shopify WordPress Discussion

php 8: warning of attempt to read property "id" on null: wp tailor advanced

I inherited an old wordpress website running on php 7.4 and with the website builder plugin "Tailor", which has been discontinued for some time now. This website serves as content source to be copied to the new, modernised website - that's why I want to keep the old outdated site. To have the new site running, i want to upgrade to php 8.1 but then the old site breaks (the template still shows correctly but the dynamic content is not displayed). a php warning is shown: Warning: Attempt to read property "id" on null in /home/.sites/64/sitexxxxxx/web/wp-content/plugins/tailor-advanced/includes/helpers-general.php on line 258 looking in the code, i find this part around line 258: $priority = 0; foreach ( (array) $element->controls() as $control ) { /* var $control Tailor_Control */ if ( $control->section == 'colors' ) { $priority += 10; } } $element->add_setting( 'shadow_color', array( 'sanitize_callback' => 'tailor_sanitize_color', 'refresh' => array( 'method' => 'js', ), ) ); $element->add_control( 'shadow_color', array( 'label' => __( 'Shadow color', 'tailor-advanced' ), 'type' => 'colorpicker', 'rgba' => '1', 'dependencies' => array( 'shadow' => array( 'condition' => 'equals', 'value' => '1', ), ), 'priority' => $priority += 10, 'section' => 'colors', ) ); // // Attribute settings // $shadow_control = false; foreach ( (array) $element->controls() as $control ) { /* var $control Tailor_Control */ if ( $control->setting->id == 'shadow' ) { $shadow_control = $control; break; } } if ( $shadow_control ) { $priority = (int) $shadow_control->priority; $element->add_setting( 'shadow_horizontal', array( 'sanitize_callback' => 'tailor_sanitize_number', 'default' => '0', 'refresh' => array( 'method' => 'js', ), ) ); the line 258 is if ( $control->setting->id == 'shadow' ) { $shadow_control = $control; break; } is there a quick and dirty way to tweak the code so that the old site will work on php 8.1 until we have transferred the content we need to the new site?
It looks like it's trying to access a property that doesn't exist. I'd check to see if its set and then check for the value if(isset($control->setting)) { if($control->setting->id == 'shadow'){ $shadow_control = $control; break; } } Run code snippetExpand snippet

January 20, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.