I am trying to: The WYSIWYG fields wouldn't load on the edit page, and this error was displayed in the log:
PHP Fatal error: Uncaught TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in xxxxxx/wp-includes/formatting.php:4290
Link to a page where the issue can be seen: Live site, so I move the PHP version back to 7.4
I expected to see: the HTML fields, but instead it didn't load and showed a fatal error.
It works as it should in 7.4, but not in 8.1
All plugins are up to date.
Hi there,
Would you please remove the conditional and add it again?
We had a case that the conditional had a wrong left/right values and that had issues with PHP 8.
Thank you.
I am not sure what you mean by conditional. The error is showing in the admin, and not on the page. And this is a WYSIWYG field, and not a conditional field??
Hi there,
Thanks, sorry for the misunderstanding.
Just to make sure that we re on the same page, Toolset does not support PHP 8.1 yet. It supports PHP 8:
Please change the PHP version to 8.0.X and test. If the issue is there please follow the steps below:
- IMPORTANT STEP! Create a backup of your website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and Toolset add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.
Thanks.
So I switched to PHP 8.0 ... but the issue comes back and is not resolved.
Unfortunately at this time I don't have time to do a full plugin elimination attempt. I'll have to come back to this. If this isn't something that has come up with others, it is likely unique to my build. The trace stack doesn't seem to have any other plugin calls.
So in this situation, PHP 8.0 and 8.1 are affecting my WYSIWYG fields loading in the admin of a custom field type, and causes a fatal error. WordPress 6.1.1 and the AVADA theme.
Here is the full error log for the PHP 8.0 attempt.
[21-Dec-2022 14:29:26 UTC] PHP Fatal error: Uncaught TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in /xxx/public_html/wp-includes/formatting.php:4290
Stack trace:
#0 /xxx/public_html/wp-includes/formatting.php(4290): htmlspecialchars()
#1 /xxx/public_html/wp-includes/class-wp-hook.php(308): format_for_editor()
#2 /xxx/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#3 /xxx/public_html/wp-includes/class-wp-editor.php(285): apply_filters()
#4 /xxx/public_html/wp-includes/general-template.php(3812): _WP_Editors::editor()
#5 /xxx/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php(153): wp_editor()
#6 /xxx/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php(52): WPToolset_Field_Wysiwyg->_editor()
#7 /xxx/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.form_factory.php(309): WPToolset_Field_Wysiwyg->metaform()
#8 /xxx/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/bootstrap.php(66): FormFactory->metaform()
#9 /xxx/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/api.php(25): WPToolset_Forms_Bootstrap->field()
#10 /xxx/public_html/wp-content/plugins/types/vendor/toolset/types/embedded/includes/fields-post.php(534): wptoolset_form_field()
#11 /xxx/public_html/wp-admin/includes/template.php(1409): wpcf_admin_post_meta_box()
#12 /xxx/public_html/wp-admin/edit-form-advanced.php(688): do_meta_boxes()
#13 /xxx/public_html/wp-admin/post.php(206): require('/xxx/...')
#14 {main}
thrown in /xxx/public_html/wp-includes/formatting.php on line 4290
[21-Dec-2022 14:30:12 UTC] PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in /xxx/public_html/wp-includes/formatting.php on line 4290
Hi there,
Thank you for the details. I checked and at the time being this seems to be something related to your installation.
if you have got time please do the plugin conflict test to continue the investigation.
The ticket will be closed after ten days, but if needed just open up another ticket and share the link to this ticket and we will continue.
Thanks.
I disabled all of the plugins, and it still persisted, which meant it was toolset files or a database entry. Rather than foo with files I tried to verify the database information.
It turned out to be one particular entry. When I went into the database that field had :
as the entry, for that content. When I removed that, the error when away. The odd thing, was I duplicated the instance locally and went through the updates as I did on the live server, but the error never showed locally. Odd. Thank you for your assistance to solve my issue.
Thank you for your answer and sharing the solution if our other customers encounter the same thing.