Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP deprecated notice #21455

Closed
3 of 11 tasks
shabnam611 opened this issue Jun 27, 2024 · 10 comments · Fixed by #22007
Closed
3 of 11 tasks

PHP deprecated notice #21455

shabnam611 opened this issue Jun 27, 2024 · 10 comments · Fixed by #22007

Comments

@shabnam611
Copy link

shabnam611 commented Jun 27, 2024

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

To Reproduce

Step-by-step reproduction instructions

  1. When using PHP 8.1 with Yoast SEO 22.9, the debug log shows PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /wp-content/plugins/wordpress-seo/src/presenters/canonical-presenter.php on line 49

Screenshots, screen recording, code snippet

If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.

Technical info

  • If relevant, which editor is affected (or editors):
  • Block Editor
  • Gutenberg Editor
  • Elementor Editor
  • Classic Editor
  • Other:
  • Which browser is affected (or browsers):
  • Chrome
  • Firefox
  • Safari
  • Other:

Used versions

  • Device you are using:
  • Operating system:
  • PHP version: 8.1.28
  • WordPress version: 6.5.4
  • WordPress Theme: Hello Elementor
  • Yoast SEO version: 22.9
  • Gutenberg plugin version:
  • Elementor plugin version:
  • Classic Editor plugin version:
  • Relevant plugins in case of a bug:
@shabnam611
Copy link
Author

Please inform the customer of conversation # 1148586 when this conversation has been closed.

@y-noel-baguio
Copy link

Please include this customer of conversation # 1174638 when this conversation has been closed.

@janwinmadrona
Copy link

Please inform the customer of conversation # 1185511 when this conversation has been closed.

@robinwilson16
Copy link

Is this going to be fixed at some point given PHP 8.1 released in 2021 and the current version is 8.3.
It looks like a small adjustment is needed to the function call to resolve this.

@suascat
Copy link

suascat commented Dec 20, 2024

@monkeyArms
Copy link

Literally all that needs to be done to fix this is change line 49 to this:

return \urldecode( \trim( (string) \apply_filters( 'wpseo_canonical', $this->presentation->canonical, $this->presentation ) ) );

Note that the (string) cast that is currently on the trim() call is redundant because trim() can only return a string.

@josevarghese
Copy link
Contributor

Hi @monkeyArms

Thank you for taking the time to check this issue and for sharing the fix! We truly appreciate your contribution and enthusiasm.

We would love for you to submit your fix as a Pull Request. It will be a great way to ensure your contribution gets properly reviewed and integrated into the project by our development team. You can find more details about contributing here.

I appreciate any help you can provide.

aanduque added a commit to aanduque/wordpress-seo that referenced this issue Jan 30, 2025
@aanduque
Copy link
Contributor

@josevarghese this notice generates an enormous amount of noise if tools like Sentry or similar are in place. We have a composer patch to patch this up in place, but would love it if it could make it upstream.

@josevarghese
Copy link
Contributor

Hi @aanduque

Thanks for the comment and for taking the time to create a Pull Request! We appreciate your contribution and will look it over as soon as possible. Your efforts to improve the project mean a lot to us.

@mikigeniston
Copy link

Please inform the customer of conversation # 1226199 when this conversation has been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants