Skip Navigation

[Resolved] TRIM custom Shortcode for PHP 8.1+

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.

This topic contains 3 replies, has 2 voices.

Last updated by Christopher Amirian 1 year, 10 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2532329

If you attempt to use the custom function solution shown here...

https://toolset.com/forums/topic/i-want-to-trim-my-custom-field/

and your website if running PHP v8.1, it will crash the website.

Do you have an updated code?

#2532663

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

We tested the Toolset with PHP 8.0:

https://toolset.com/2022/05/toolset-1-6-3-full-compatibility-with-php-8/

But, we did not test with PHP version 8.1.

We recommend that you use PHP version 8.0 for the time being.

Having said that, I'd be happy to try and see if it is possible to update the code. But I will need the error that shows in PHP 8.1.

Would you please access your website files and edit the "wp-config.php" file on the root folder of your WordPress installation and add the code below into the file:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );

Please add the code above the line below:

/* That's all, stop editing! Happy blogging. */

After that, you will be able to share the Fatal Error in PHP 8.1.

Thanks.

#2533033

My Mistake. It doesn't look like that particular shortcode was the issue. (I had the shortcode duplicated in my functions.php file and that caused a problem.

However, after removing the duplicate shortcode in functions.php, everything worked in PHP8.0

But if I upgraded to PHP8.1, I get the following errors.

(NOTE: I am still using legacy TOOLSET plugins... like Layouts ands Views)

Any suggestions? (I know... you are going to advise to stop using the legacy plugins :).... but I really like the way Layouts allows me to create and edit my own Header/Footer area for the Toolset Starter theme )

==========================================================================

Deprecated: Return type of WPDDL_OptionsImportExport::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/classes-auto/wpddl-options.class.php on line 129

Deprecated: Return type of WPV_Settings::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/wp-views/embedded/inc/wpv-settings.class.php on line 375

Deprecated: Return type of WPV_Settings::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/wp-views/embedded/inc/wpv-settings.class.php on line 386

Deprecated: Return type of WPV_Settings::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/wp-views/embedded/inc/wpv-settings.class.php on line 401

Deprecated: Return type of WPV_Settings::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/wp-views/embedded/inc/wpv-settings.class.php on line 411

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/classes-auto/wpddl.layout.class.php on line 1296

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/classes-auto/wpddl.layout.class.php on line 1296

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/formatting.php on line 5397

Deprecated: Return type of Toolset_Settings::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/toolset.settings.class.php on line 231

Deprecated: Return type of Toolset_Settings::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/toolset.settings.class.php on line 243

Deprecated: Return type of Toolset_Settings::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/toolset.settings.class.php on line 258

Deprecated: Return type of Toolset_Settings::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/toolset.settings.class.php on line 268

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_text.class.php on line 13

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_text.class.php on line 13

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_text.class.php on line 148

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_text.class.php on line 148

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/classes-auto/cells/wpddl.layout-text-base-cell.class.php on line 7

Deprecated: Optional parameter $screen_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/classes-auto/cells/wpddl.layout-text-base-cell.class.php on line 7

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/classes-auto/cells/wpddl.layout-text-base-cell.class.php on line 7

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.missing_cell_type.class.php on line 7

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.missing_cell_type.class.php on line 7

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.child_layout.class.php on line 10

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.child_layout.class.php on line 10

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.child_layout.class.php on line 97

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.child_layout.class.php on line 97

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_content_template.class.php on line 11

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_content_template.class.php on line 11

Deprecated: Optional parameter $css_id declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_content_template.class.php on line 11

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_content_template.class.php on line 136

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_content_template.class.php on line 136

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_loop.class.php on line 9

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_loop.class.php on line 9

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_loop.class.php on line 102

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_views_loop.class.php on line 102

Deprecated: Optional parameter $depth declared before required parameter $output is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_menu.class.php on line 293

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_widget_area.class.php on line 11

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_widget_area.class.php on line 11

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_widget_area.class.php on line 34

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_widget_area.class.php on line 34

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_post-content-cell.class.php on line 16

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_post-content-cell.class.php on line 16

Deprecated: Optional parameter $css_class_name declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_post-content-cell.class.php on line 150

Deprecated: Optional parameter $content declared before required parameter $unique_id is implicitly treated as a required parameter in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/layouts/inc/cell_types/wpddl.cell_post-content-cell.class.php on line 150

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/formatting.php on line 5397

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/formatting.php on line 5397

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/functions.php on line 7022

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/functions.php on line 2162

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/toolset.settings.class.php:17) in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-admin/includes/misc.php on line 1416

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/toolset.settings.class.php:17) in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/functions.php on line 6865

Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Cookie/Jar.php on line 63

Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Cookie/Jar.php on line 73

Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Cookie/Jar.php on line 89

Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Cookie/Jar.php on line 102

Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Cookie/Jar.php on line 111

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/toolset.settings.class.php:17) in /var/www/vhosts/tjsdrinkery.com/httpdocs/wp-admin/admin-header.php on line 9

#2534757

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Unfortunately, it is not possible to do so as the Layouts plugin is not supported anymore and we do not provide updates for that.

the Views plugin is ok and we provide updates for that plugin.

What I see is that all the deprecation notices that I see are from the Layouts plugin which we can not help with.

One other point is that all the messages that you shared are notices and warnings for deprecation but it is not a fatal error, so it might be the fact that it is possible to still use the plugin.

You can simply turn off the deprecation display in WordPress:

Would you please access your website files and edit the "wp-config.php" file on the root folder of your WordPress installation and add the code below into the file:

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', false );

Please add the code above the line below:

/* That's all, stop editing! Happy blogging. */

That should force WordPress to avoid showing the notices.

Thanks.