What does the error debug.log file mean. Website is running on PHP 7.4.3. What should I do?
[27-Jun-2022 00:47:50 UTC] PHP Notice: Trying to get property 'ID' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-theme-settings/compatibility-loader/toolset-theme-integration-settings-helper.php on line 426
Looking into the code mentioned in the PHP notice, it would only be produced if, for some reason, the current post's scope is not available. It is very strange because the code itself is set to only run on the single post pages, where the current post's scope should be available at all times.
I suspect that some third-party plugin or theme is interfering with that current post's scope in some very specific situation, but, during some tests on my website, I couldn't reproduce this.
By nature, the PHP notice itself is safe to ignore. For further investigation, I'll recommend noting down when a new instance of this notice is generated in the error log and determining exactly which section of the website was being edited at that time.
This will help in narrowing it down and we might also have to request the website's clone, for that troubleshooting.
Thank you. That's good to know. I have a copy running for translation purposes on a different domain. This website isn't showing these errors. So I guess there is something wrong with this specific configuration. I changed some settings, now see how it goes. If necessary, I'll get back to you.
I got rid of some the notifications/errors. Below the most recent one's. The one from Toolset is still there. Not sure what to do?
[30-Jun-2022 01:08:37 UTC] PHP Notice: Undefined index: stock_status in /var/www/vhosts/light4u.io/httpdocs/wp-content/plugins/wpai-woocommerce-add-on/libraries/XmlImportWooCommerceService.php on line 361
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'ID' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-theme-settings/compatibility-loader/toolset-theme-integration-settings-helper.php on line 426
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'ID' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-content/plugins/google-analytics-premium/pro/includes/frontend/class-frontend.php on line 336
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:45 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'ID' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-theme-settings/compatibility-loader/toolset-theme-integration-settings-helper.php on line 426
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'ID' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-content/plugins/google-analytics-premium/pro/includes/frontend/class-frontend.php on line 336
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
[30-Jun-2022 07:11:56 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/vhosts/light4u.io/httpdocs/wp-includes/class-wp-query.php on line 4338
Can you please share the temporary admin login details of the website where this error is being generated? I'll also need your permission to download a clone/snapshot of the website, in case it needs to be investigated on a different server.
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
I've been randomly visiting different front-end and admin area sections on your website's clone, but so far haven't seen the same notice about the missing post object/ID.
(I have the same PHP 7.4.30 version on this test server, as your website)
I suspect this is related to the cache, optimization, and CDN plugin enabled on your website, as these are the only plugins that are disabled on the clone that I have.
It seems, that one of those plugins is calling WordPress' "is_singular" function, earlier than the post object has been set or for a post/revision, that no longer exists. And as a result, the notices are recorded. And those notices are not just coming from Toolset. You'll see similar notices getting generated by the code from plugins like 'google-analytics-premium', 'wpai-woocommerce-add-on', and even WordPress file 'class-wp-query.php'.
I'm afraid, it won't be possible for us to investigate deeper into a notice that is not limited to Toolset, but, the good news is that I don't expect this notice to cause any functional issue on your website.
Great, thanks a lot for your efforts and investigation! Good to know that it won't cause any functional errors. I will contact Litespeed and/or EWWW to investigate the issue and will share your findings with them to check.