Skip Navigation

[Resolved] Fatal Error After Modifying a Condition in a Content Template

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 reply, has 1 voice.

Last updated by manuelL-5 1 year, 2 months ago.

Author
Posts
#2636765

Tell us what you are trying to do?
Hello,

I've encountered a fatal error on my site after making an adjustment to a condition within a specific Content Template 9504, and the condition I added was:

( ( 'wpcf-solicitud-estilo' eq '1' ) OR ( 'wpcf-solicitud-estilo' eq '' ) )

Following this change, I was presented with the following error:

[23-Aug-2023 15:55:37 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /home/pasninja/public_html/wp-content/plugins/toolset-blocks/backend/Models/ContentTemplate/UsageCondition.php:129
Stack trace:
#0 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/backend/Models/ContentTemplate/UsageConditionGroup.php(137): OTGS\Toolset\Views\Models\ContentTemplate\UsageCondition::createFromDatabaseArray(Array)
#1 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/backend/Models/ContentTemplate/UsageSettings.php(100): OTGS\Toolset\Views\Models\ContentTemplate\UsageConditionGroup::createFromDatabaseArray(Array)
#2 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/backend/Models/ContentTemplate/UsagePostType.php(142): OTGS\Toolset\Views\Models\ContentTemplate\UsageSettings::createFromDatabaseArray(Array)
#3 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/embedded/inc/wpv-archive-loop.php(1436): OTGS\Toolset\Views\Models\ContentTemplate\UsagePostType::createFromDatabaseArray(0, Array)
#4 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/embedded/inc/classes/wpv-content-template-embedded.class.php(233): WPV_WordPress_Archive_Frontend->get_archive_loops('post_type', false, true, true)
#5 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Integrations/Views/Internals.php(51): WPV_Content_Template_Embedded->get_assigned_single_post_types()
#6 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Integrations/Views.php(72): Toolset\DynamicSources\Integrations\Views\Internals->get_assigned_post_types(13080)
#7 /home/pasninja/public_html/wp-includes/class-wp-hook.php(310): Toolset\DynamicSources\Integrations\Views->adjust_post_types_for_source_context_in_cts('view-template', 13080)
#8 /home/pasninja/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('view-template', Array)
#9 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(375): apply_filters('toolset/dynamic...', 'view-template', 13080)
#10 /home/pasninja/public_html/wp-includes/class-wp-hook.php(310): Toolset\DynamicSources\DynamicSources->register_sources('')
#11 /home/pasninja/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array)
#12 /home/pasninja/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#13 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(775): do_action('toolset/dynamic...')
#14 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(744): Toolset\DynamicSources\DynamicSources->get_shortcode_content(Array)
#15 /home/pasninja/public_html/wp-includes/shortcodes.php(395): Toolset\DynamicSources\DynamicSources->dynamic_shortcode_render(Array, '', 'tb-dynamic')
#16 [internal function]: do_shortcode_tag(Array)
#17 /home/pasninja/public_html/wp-includes/shortcodes.php(235): preg_replace_callback('/\\[(\\[?)(tb\\-dy...', 'do_shortcode_ta...', '[tb-dynamic pro...')
#18 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(920): do_shortcode('[tb-dynamic pro...')
#19 [internal function]: Toolset\DynamicSources\DynamicSources->Toolset\DynamicSources\{closure}(Array)
#20 /home/pasninja/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(919): preg_replace_callback('#(\\[tb-dynamic\\...', Object(Closure), '<!-- wp:toolset...')
#21 /home/pasninja/public_html/wp-includes/class-wp-hook.php(310): Toolset\DynamicSources\DynamicSources->shortcode_render('<!-- wp:toolset...')
#22 /home/pasninja/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('<!-- wp:toolset...', Array)
#23 /home/pasninja/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1864): apply_filters('the_content', '<!-- wp:toolset...')
#24 /home/pasninja/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(569): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request))
#25 /home/pasninja/public_html/wp-includes/rest-api/class-wp-rest-server.php(1188): WP_REST_Posts_Controller->get_item(Object(WP_REST_Request))
#26 /home/pasninja/public_html/wp-includes/rest-api/class-wp-rest-server.php(1035): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/view-tem...', Array, NULL)
#27 /home/pasninja/public_html/wp-includes/rest-api.php(545): WP_REST_Server->dispatch(Object(WP_REST_Request))
#28 /home/pasninja/public_html/wp-includes/rest-api.php(2911): rest_do_request(Object(WP_REST_Request))
#29 [internal function]: rest_preload_api_request(Array, '/wp/v2/view-tem...')
#30 /home/pasninja/public_html/wp-includes/block-editor.php(743): array_reduce(Array, 'rest_preload_ap...', Array)
#31 /home/pasninja/public_html/wp-admin/edit-form-blocks.php(77): block_editor_rest_api_preload(Array, Object(WP_Block_Editor_Context))
#32 /home/pasninja/public_html/wp-admin/post.php(187): require('/home/pasninja/...')
#33 {main}
thrown in /home/pasninja/public_html/wp-content/plugins/toolset-blocks/backend/Models/ContentTemplate/UsageCondition.php on line 129

Steps to Reproduce:

Accessed the Content Template with ID 9504.
Modified the existing condition and added the one mentioned above.
Saved the changes.
Experienced the fatal error when attempting to access certain parts of my site.
What I've Tried:

Checked the database and looked into entries related to the Content Template.
Deactivated and reactivated various plugins to pinpoint potential conflicts.
I'm seeking assistance to resolve this issue and ensure it doesn't recur in the future. Could you assist in identifying and fixing the problem?

Thank you!
Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#2636799

What I did was deactivate the post request and send the template to the trash and then activate it and now it works fine. But I don't know how to get it back.