Home › Toolset Professional Support › [Resolved] Toolset Blocks Throwing Error
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 |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9: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/Karachi (GMT+05:00)
Tagged: Content Templates, Toolset Blocks, Views plugin
Related documentation:
I am trying to:
I activated Toolset Blocks. When it is activated, I receive the following error...
Webolution version 6.3.2
Active theme: Astra (version 4.3.1)
Current plugin: Toolset Blocks (version 1.6.8)
PHP version 8.1.24
Error Details
=============
An error of type E_ERROR was caused in line 129 of the file /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsageCondition.php. Error message: Uncaught TypeError: Cannot access offset of type string on string in /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsageCondition.php:129
Stack trace:
#0 /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsageConditionGroup.php(137): OTGS\Toolset\Views\Models\ContentTemplate\UsageCondition::createFromDatabaseArray(Array)
#1 /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsageSettings.php(100): OTGS\Toolset\Views\Models\ContentTemplate\UsageConditionGroup::createFromDatabaseArray(Array)
#2 /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsagePostType.php(142): OTGS\Toolset\Views\Models\ContentTemplate\UsageSettings::createFromDatabaseArray(Array)
#3 /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Services/ContentTemplateService.php(167): OTGS\Toolset\Views\Models\ContentTemplate\UsagePostType::createFromDatabaseArray(0, Array)
#4 /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Services/ContentTemplateService.php(143): OTGS\Toolset\Views\Services\ContentTemplateService->calculate_template_for(Object(WP_Post), 0)
#5 /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Controllers/Admin/ContentTemplate.php(108): OTGS\Toolset\Views\Services\ContentTemplateService->get_template_for(Object(WP_Post))
#6 /var/web/staging/public_html/wp-includes/class-wp-hook.php(310): OTGS\Toolset\Views\Controllers\Admin\ContentTemplate->get_content_template_for_post(0, Object(WP_Post))
#7 /var/web/staging/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(0, Array)
#8 /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/embedded/inc/views-templates/wpv-template.class.php(873): apply_filters('wpv_content_tem...', 0, Object(WP_Post))
#9 /var/web/staging/public_html/wp-includes/class-wp-hook.php(310): WPV_template->the_content('Esta...')
#10 /var/web/staging/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('Esta...', Array)
#11 /var/web/staging/public_html/wp-includes/post-template.php(256): apply_filters('the_content', 'Esta...')
#12 /var/web/staging/public_html/wp-content/plugins/woocommerce/templates/single-product/tabs/description.php(30): the_content()
#13 /var/web/staging/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('/var/web/stagin...')
#14 /var/web/staging/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1864): wc_get_template('single-product/...')
#15 /var/web/staging/public_html/wp-content/plugins/woocommerce/templates/single-product/tabs/tabs.php(47): woocommerce_product_description_tab('description', Array)
#16 /var/web/staging/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('/var/web/stagin...')
#17 /var/web/staging/public_html/wp-content/plugins/elementor-pro/modules/woocommerce/widgets/product-data-tabs.php(279): wc_get_template('single-product/...')
#18 /var/web/staging/public_html/wp-content/plugins/elementor/includes/base/controls-stack.php(2265): ElementorPro\Modules\Woocommerce\Widgets\Product_Data_Tabs->render()
#19 /var/web/staging/public_html/wp-content/plugins/elementor/includes/base/widget-base.php(609): Elementor\Controls_Stack->render_by_mode()
#20 /var/web/staging/public_html/wp-content/plugins/elementor/includes/base/widget-base.php(733): Elementor\Widget_Base->render_content()
#21 /var/web/staging/public_html/wp-content/plugins/elementor/includes/base/element-base.php(551): Elementor\Widget_Base->get_raw_data(true)
#22 /var/web/staging/public_html/wp-content/plugins/elementor/includes/base/element-base.php(551): Elementor\Element_Base->get_raw_data(true)
#23 /var/web/staging/public_html/wp-content/plugins/elementor/core/base/document.php(1013): Elementor\Element_Base->get_raw_data(true)
#24 /var/web/staging/public_html/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(444): Elementor\Core\Base\Document->get_elements_raw_data(Array, true)
#25 /var/web/staging/public_html/wp-content/plugins/elementor/core/base/document.php(679): ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document->get_elements_raw_data(NULL, true)
#26 /var/web/staging/public_html/wp-content/plugins/elementor/modules/library/documents/library-document.php(66): Elementor\Core\Base\Document->get_initial_config()
#27 /var/web/staging/public_html/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(666): Elementor\Modules\Library\Documents\Library_Document->get_initial_config()
#28 /var/web/staging/public_html/wp-content/plugins/elementor/includes/base/controls-stack.php(1010): ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document->get_initial_config()
#29 /var/web/staging/public_html/wp-content/plugins/elementor/core/editor/loader/common/editor-common-scripts-settings.php(33): Elementor\Controls_Stack->get_config()
#30 /var/web/staging/public_html/wp-content/plugins/elementor/core/editor/loader/v1/editor-v1-loader.php(76): Elementor\Core\Editor\Loader\Common\Editor_Common_Scripts_Settings::get()
#31 /var/web/staging/public_html/wp-content/plugins/elementor/core/editor/editor.php(358): Elementor\Core\Editor\Loader\V1\Editor_V1_Loader->enqueue_scripts()
#32 /var/web/staging/public_html/wp-includes/class-wp-hook.php(310): Elementor\Core\Editor\Editor->enqueue_scripts('')
#33 /var/web/staging/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array)
#34 /var/web/staging/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#35 /var/web/staging/public_html/wp-includes/script-loader.php(2225): do_action('wp_enqueue_scri...')
#36 /var/web/staging/public_html/wp-includes/class-wp-hook.php(310): wp_enqueue_scripts('')
#37 /var/web/staging/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array)
#38 /var/web/staging/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#39 /var/web/staging/public_html/wp-includes/general-template.php(3053): do_action('wp_head')
#40 /var/web/staging/public_html/wp-content/plugins/elementor/includes/editor-templates/editor-wrapper.php(31): wp_head()
#41 /var/web/staging/public_html/wp-content/plugins/elementor/core/editor/loader/v1/editor-v1-loader.php(110): include('/var/web/stagin...')
#42 /var/web/staging/public_html/wp-content/plugins/elementor/core/editor/editor.php(163): Elementor\Core\Editor\Loader\V1\Editor_V1_Loader->print_root_template()
#43 /var/web/staging/public_html/wp-includes/class-wp-hook.php(310): Elementor\Core\Editor\Editor->init('')
#44 /var/web/staging/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array)
#45 /var/web/staging/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#46 /var/web/staging/public_html/wp-admin/admin.php(419): do_action('admin_action_el...')
#47 /var/web/staging/public_html/wp-admin/post.php(12): require_once('/var/web/stagin...')
#48 {main}
thrown
Link to a page where the issue can be seen:
hidden link
I have reinstalled to no avail. Also, this might be related, but I am getting a communication error even though I have added the site and put in the registration key (toolset: Unable to register: Site key not matching).
Hi,
Thank you for contacting us and I'd be happy to assist.
Can you temporarily switch to PHP 7 and see if the error is fixed and you're able to edit this page from the admin area? If you can, please ensure no conditional block with an incomplete or incorrect condition is there.
Once, fixed you can switch back to PHP 8.
For the communication error, every Toolset site key is generated for an individual website's address. If there is some change in the website's address, you'll need to generate a new one.
You can regenerate the site key for your current website, by following these steps:
- Please go to your Toolset account's sites management page: https://toolset.com/account/sites/
- Remove the site key which is showing the mismatch message
- Register the same site again, making sure that the URL matches the one set at WP Admin -> Settings -> General -> Site Address (URL)
- Go to your site dashboard again and register the plugin with the newly generated key.
( ref: https://toolset.com/faq/how-to-install-and-register-toolset/ )
Tip: You can check the communication error details by visiting this link in the admin area:
{yourwebsite.com}/wp-admin/admin.php?page=otgs-installer-support
Note: You'll replace {yourwebsite.com} with your website's URL.
I hope this helps and let me know how it goes.
regards,
Waqar
I cannot roll back to PHP7 as I am on a server that only has 8. PHP 7 had been end-of-lifed (as an fyi).
As for the mismatched key. I did the exact steps you mentioned and it did not fix it.
Thank you for sharing this update and it is strange that it didn't work.
Can you please share the temporary admin login details? 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 making a complete backup copy is recommended before sharing the access details.
Thank you for the permission and I've downloaded the website's clone.
I'll be running some tests and will share the findings, as soon as this testing completes.
Thank you for your patience.
Thank you for waiting, as I completed the troubleshooting around this error.
I noticed that there are two content templates on your website, where the usage/assignment conditions aren't set correctly.
- Retail Customers - Map ( ID: 9176 )
- Template for Products ( ID: 26753 )
It is possible that they were set to use a field or taxonomy that is no longer available.
When using PHP 7, this results in a warning, but the content templates are still editable and you can change/adjust the assignment condition from the usage section of the content template's edit screen.
However, since you mentioned your server doesn't support PHP 7, you'll need to make some database-level changes, to get this fixed.
Using a tool like phpMyAdmin, you can find the 'usage' custom field record in the '{table-prefix}_postmeta' table and remove it, for these two content templates, where the 'post_id' are '9176' and '26753'.
Note: If this seems too technical you can also consult your hosting support team to assist you with this.
Once these custom field values have been removed for these two templates, the error will be fixed and you'll be able to assign the templates again, to the desired post types, from their post type edit screen.
Thank you for getting back to me. I removed the 'usage' meta key entries for each of these records. I reactivated the plugin. I then went into the template. The issue still exists. I am attaching a screen shot. The log showed the following...
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsageCondition.php:129
There is a stacktrace if you want it. Just let me know.
I am also attaching a screenshot from the db.
That is strange that you're still getting the error.
Is the error stack trace the same as before?
Here are correct/fixed entries for the 'usage' custom field, if you'd like to add a new record for them in the database:
Template for Products (ID: 26753)
Value:
a:1:{i:0;a:4:{s:9:"post_type";s:7:"product";s:7:"enabled";b:1;s:10:"conditions";N;s:17:"parsed_conditions";N;}}
Retail Customers (Map ID: 9176)
Value:
a:1:{i:0;a:4:{s:9:"post_type";s:15:"retail-customer";s:7:"enabled";b:1;s:10:"conditions";N;s:17:"parsed_conditions";N;}}
If your server has a database object cache enabled, please make sure that the cache has been cleared.
I am attaching a screenshot of the db changes I made to ensure they are correct. I am still running into the error. I am attaching a screenshot of the error along with an entry from the log file.
fyi...I do not have any caching enabled in the staging area.
Log entry...
[25-Oct-2023 15:16:44 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsageCondition.php:129
The error in the browser console is...
hidden link 500 (Internal Server Error)
Please advise.
Would it be possible for you to share the FTP access details?
I'm setting your next reply as private.
Thank you for the sFTP details.
I had unusually busy forum queue over the weekend, but I'll get back to you with a detailed update, within the next few hours.
Thank you for your patience.
Thank you for waiting.
I noticed that both affected content templates don't have much content in them. One of them only has a single paragraph tag and other one has view, that is showing the view not found message.
Instead of adding any changes to the Blocks plugin core files it would be simpler to delete the record of these templates from the 'wp_z6_posts' table, through their IDs:
- Retail Customers - Map ( ID: 9176 )
- Template for Products ( ID: 26753 )
Once, deleted you'll no longer see the error when visiting the content template management screen. And you'll be able to add those content templates again, as needed.
Additional note: For cleanup, you can also delete the custom fields records associated with these template IDs from 'wp_z6_postmeta' table.
If I delete those items from the 'wp_z6_posts' table, will those CPTs still exist?
Yes, the posts in those CPTs will still exist.
We're just deleting the posts that are the two content templates.
I removed all of those entries from the db and I am still getting an error when I go to the Toolset Dashboard and when I go into the template to work on the layout of the page. Here is the error...
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/web/staging/public_html/wp-content/plugins/_toolset-blocks/backend/Models/ContentTemplate/UsageCondition.php:129