Skip Navigation

[Resolved] Critical Error when editing content template

This support ticket is created 2 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 3 voices.

Last updated by John Appleseed 2 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#2442573

Hello! When I attempt to edit a Content Template I'm getting "There has been a critical error on this website." In the debug info sent to my email I'm seeing the following:

WordPress version 6.0.1
Active theme: Understrap (version 1.1.0)
Current plugin: Toolset Blocks (version 1.6.3)
PHP version 8.0.11



Error Details
=============
An error of type E_ERROR was caused in line 67 of the file
/var/www/html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php.
Error message: Uncaught Error: Attempt to assign property
"dynamic_sources_content_processed" on null in
/var/www/html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php:67
Stack trace:
#0 /var/www/html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(514):
Toolset\DynamicSources\Sources\PostContent->get_content()
#1 /var/www/html/wp-includes/class-wp-hook.php(307):
Toolset\DynamicSources\DynamicSources->get_source_content()
#2 /var/www/html/wp-includes/plugin.php(191): WP_Hook->apply_filters()
#3 /var/www/html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Cache.php(92):
apply_filters()
#4 [internal function]: Toolset\DynamicSources\Cache->get_data_for_sources()
#5 /var/www/html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Cache.php(49):
call_user_func_array()
#6 /var/www/html/wp-includes/class-wp-hook.php(307):
Toolset\DynamicSources\Cache->add_cached_data()
#7 /var/www/html/wp-includes/plugin.php(191): WP_Hook->apply_filters()
#8 /var/www/html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(967):
apply_filters()
#9 /var/www/html/wp-includes/class-wp-hook.php(307):
Toolset\DynamicSources\DynamicSources->get_dynamic_sources_data()
#10 /var/www/html/wp-includes/plugin.php(191): WP_Hook->apply_filters()
#11 /var/www/html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(942):
apply_filters()
#12 /var/www/html/wp-includes/class-wp-hook.php(307):
Toolset\DynamicSources\DynamicSources->register_localization_data()
#13 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#14 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action()
#15 /var/www/html/wp-admin/edit-form-blocks.php(270): do_action()
#16 /var/www/html/wp-admin/post.php(187): require('...')
#17 {main}
  thrown

Everything has been working fine so I'm guessing that something auto updated and caused a conflict. When I searched the forum I found another post from this year suggesting maybe this is a PHP8 incompatibility? I'm still able to edit Views and Custom Fields. Not sure if this is related, but one of the posts of the Custom Post Type is set to Private to hide it from the front end View results.

Let me know how you think I should proceed, thanks!

#2442623

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

PHP 8.0.x should be fine (there may be some issues with 8.1.x, that isn't fully tested yet).

But the problem could have arisen from some 3rd-party plugin update giving rise to a conflict.

Ideally test for that on a staging server.

Disable all plugins except Toolset, and make sure you are not running any custom code (if you edited the theme's functions.php file, switch theme to twentytwenty, and disable any code snippets added in Toolset > Settings). Then try editing and updating the template again.

If the problem no longer appears then you should be able to determine the source of any conflict that triggers the problem by a process of elimination.

Let us know how you get on.

I'm going to set up a private reply so that if the issue isn't resolved we can take a look (again, ideally on a staging server).

You may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.

Can you also confirm the template you are editing?

#2442875

Hi! I don't see the private reply option, but I can confirm that the issue is still present.
- I deactivated all plugins except for Toolset
- I deactivated my two custom code snippets
- I set the theme to Twenty twenty

I have a staging site setup and can provide the credentials once the private reply is ready. Thanks for your help!

#2443067

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL of the template where I can see the issue.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

'

#2443457

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To investigate this issue further I will require to access the database and for that either I will require database access details or you can share duplicator copy of your site.

Can you please send me duplicator copy of your site:
- https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2444121

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I installed the duplicator copy on my local machine and strange thing is that for me I can edit the content template without any issue. Please check the following screenshot:
- hidden link

Is it possible for you to send me database access details or tell me how can I access the database on your staging site?

I have set the next reply to private which means only you and I have access to it.

#2444213

Hi again. I'm sorry but with the way the staging site is currently configured as a table on the production database, I'm unable to easily provide access. I was able to workaround the bug in the following way:
- Use the Duplicate function to make a new copy of the Content Template.
- Set Usage for the new Content Template to the correct custom post type.

After this, I was able to edit the new version of the Content Template. After seeing that the debug info says "Attempt to assign property "dynamic_sources_content_processed" on null" and searching similar issues in the Toolset forum, my guess is that the dynamic preview in the block editor is attempting to use a post that has been deleted, and there is no graceful fallback, so the code runs on a null object and crashes. By duplicating the Content Template, the dynamic preview uses the latest published post of that type so everything works again. This doesn't explain to me why the original template crashes on my server but works on yours, maybe it's holding onto the deleted post value in OPCache, but when moved to your server it rebuilt that value.

At any rate I see a similar issue in the forum from only 2 months ago, and the Supporter says he opened a bug ticket to create a graceful fallback when the previewed post is no longer present, so I'll watch out for a fix! Thanks for your help troubleshooting.