Deprecation warning in PHP 8.2
-
Here’s the stack trace:
trim(): Passing null to parameter #1 ($string) of type string is deprecated
E_DEPRECATED at /wp-content/plugins/wordpress-seo/src/presenters/canonical-presenter.php(49):
#0 [internal function]: {closure}()
#1 /wp-content/plugins/wordpress-seo/src/presenters/canonical-presenter.php(49): trim()
#2 /wp-content/plugins/wordpress-seo/src/presenters/abstract-indexable-tag-presenter.php(37): Yoast\WP\SEO\Presenters\Canonical_Presenter->get()
#3 /wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(395): Yoast\WP\SEO\Presenters\Abstract_Indexable_Tag_Presenter->present()
#4 /wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Front_End_Integration->present_head()
#5 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#6 /wp-includes/plugin.php(517): WP_Hook->do_action()
#7 /wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(366): do_action()
#8 /wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Front_End_Integration->call_wpseo_head()
#9 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()Looks like the following line just needs to be made null-safe:
return \urldecode( (string) \trim( \apply_filters( 'wpseo_canonical', $this->presentation->canonical, $this->presentation ) ) );
Whilst I appreciate that deprecation warnings don’t affect functionality, it’s obviously best practice to fix them, and what’s deprecated in one PHP branch usually throws an error in the next one, in which case it will need fixing at some point. I’m using version 24.1 if that helps.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.