Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 894 forks source link

Error handling for the property "name" in /public_html/wp-content/plugins/wordpress-seo/src/integrations/watchers/primary-term-watcher.php on line 124 #21311

Open metricmediabob opened 7 months ago

metricmediabob commented 7 months ago

Please give us a description of what happened

Server log files contain many instances of the following error:

PHP Warning: Attempt to read property "name" on bool in /public_html/wp-content/plugins/wordpress-seo/src/integrations/watchers/primary-term-watcher.php on line 124

To Reproduce

Step-by-step reproduction instructions

  1. Use Yoast SEO - no special configuration
  2. Log into WordPress as a public WooCommerce user and attempt to update your name
  3. Function errors due to $taxonomy not being an object instance

Expected results

  1. Function type-checks $taxonomy before attempting to extract a property from it.

Actual results

  1. Warning is generated

Screenshots, screen recording, code snippet

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

PHP Warning: Attempt to read property "name" on bool in /public_html/wp-content/plugins/wordpress-seo/src/integrations/watchers/primary-term-watcher.php on line 124

Technical info

Used versions

josevarghese commented 7 months ago

Hi @metricmediabob

Thanks for using the Yoast SEO plugin and also for creating the issue.

I tried reproducing this issue on my lab site after enabling the WP_DEBUG. However, I cannot see the error you mentioned while updating the name from the public WooCommerce page. So, can you please try this on a new WP installation and let us know whether the issue persists there or not? If yes, could you please share a screencast of it and share it with us to confirm that we didn't miss any steps in replicating it?

metricmediabob commented 7 months ago

Hi Jose,

I’m not suggesting the missing name parameter is the problem. That is undoubtedly due to our particular configuration and at some point we’ll debug it.

I am saying that Yoast isn’t handling the error gracefully. Since it’s possible for the name parameter to have an incorrect type, Yoast should type-check the parameter before assuming it is the correct type. Not doing so fills up error logs with messages.

Bob Meador | Principal

Metric Media, Inc. 206.219.9682 x1 [office] 206.679.6026 [mobile] @. @.> www.metricmedia.com http://www.metricmedia.com/

On Apr 22, 2024, at 3:10 AM, Jose Varghese @.***> wrote:

Hi @metricmediabob https://github.com/metricmediabob Thanks for using the Yoast SEO plugin and also for creating the issue.

I tried to reproduce this issue on my lab site after enabling the WP_DEBUG. But I am not able to see the error you mentioned while updating the name from the public WooCommerce page. So, can you please try this on a new WP installation and let us know whether the issue persists over there or not? If yes, could you please share a screencast of it and share it with us to confirm that we didn't miss any steps with replicating it?

— Reply to this email directly, view it on GitHub https://github.com/Yoast/wordpress-seo/issues/21311#issuecomment-2069004511, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBOHFAZWEMNVYM6DXDZ2L3Y6TOYTAVCNFSM6AAAAABGCXSPO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGAYDINJRGE. You are receiving this because you were mentioned.

josevarghese commented 7 months ago

Hi Bob,

Thanks for getting back to us. Can you please let us know whether you are using the latest version of the Yoast SEO plugin, 22.5, on the website and the WooCommerce plugin, 8.8.2? I'm asking this because you haven't filled in those version details while submitting the issue.

We look forward to hearing from you.

metricmediabob commented 6 months ago

The site is running Yoast 22.5 and Woo 8.7.0 at present. Our next non-critical update cycle for this client is June/2024.

Bob Meador | Principal

Metric Media, Inc. 206.219.9682 x1 [office] 206.679.6026 [mobile] @. @.> www.metricmedia.com http://www.metricmedia.com/

On Apr 23, 2024, at 5:02 AM, Jose Varghese @.***> wrote:

Hi Bob,

Thanks for getting back to us. Can you please let us know whether you are using the latest version of the Yoast SEO plugin, 22.5, on the website and the WooCommerce plugin, 8.8.2? I'm asking this because you haven't filled in those version details while submitting the issue.

We look forward to hearing from you.

— Reply to this email directly, view it on GitHub https://github.com/Yoast/wordpress-seo/issues/21311#issuecomment-2072122877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBOHFH3OUSIBWG6SADRHB3Y6ZEV3AVCNFSM6AAAAABGCXSPO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZSGEZDEOBXG4. You are receiving this because you were mentioned.

josevarghese commented 6 months ago

Thanks for letting us know. I changed the title of the issue to incorporate your request.