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

Warnings on PHP 8.x #680

Closed
ajitbohra opened this issue Jun 20, 2024 · 2 comments
Closed

Warnings on PHP 8.x #680

ajitbohra opened this issue Jun 20, 2024 · 2 comments
Labels
[Type] Support It's also a question, but a resolution is required.

Comments

@ajitbohra
Copy link

We have plans to upgrade to 8.2 here #644

In the meantime would it be good to fix some warnings on php8.x?

[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_canonical_uri" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 691
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noindex" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 706
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 830
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noarchive" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 961
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_canonical_uri" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 691
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noindex" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 706
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 830
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noarchive" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 961
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_canonical_uri" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 691
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noindex" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 706
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 830
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noarchive" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 961
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_canonical_uri" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 691
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noindex" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 706
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 830
[11-Jun-2024 23:13:48 UTC] PHP Warning:  Undefined array key "_genesis_noarchive" in /opt/wordpress/web/app/plugins/autodescription/inc/classes/admin/seobar/builder/page.class.php on line 961
@sybrew
Copy link
Owner

sybrew commented Jun 21, 2024

Hello!

TSF is compatible with PHP 7.4 ~ 8.3. The other ticket is about increasing the minimum requirements. Our websites currently work with PHP 8.1.

The plugin shouldn't emit warnings on any of the supported versions. But when it does, it's highly likely something on the site isn't working according to the standard APIs.

Here are some scenarios I figured from a dry run (ranked from difficulty to verify). With these scenarios, I expect you can see the warnings on your screen and not only via logs:

  1. I believe the SEO Bar outputting these warnings assesses a post with corrupted metadata. You should resave the post to fix the corrupted metadata; you may need to rewrite the custom SEO metadata if necessary. However, if the metadata is corrupted, you should've gotten more PHP warnings than just those.
  2. Alternatively, your site uses the SEO Bar for a post that isn't registered with WordPress (at the time the SEO Bar is rendered). This may be a conflict from a caching plugin. See if disabling the caching plugin resolves the issue, and review its settings when it does. If it does, it is likely to do with object caching, which can cause many more elusive issues.
  3. Or, the SEO Bar could've been assessing a post type that doesn't have SEO support. Please let me know if you created this post type or another plugin. If so, how or which?
  4. Or, either filter the_seo_framework_post_meta_defaults or the_seo_framework_post_meta are active and removing required keys. We found that no other public plugins filter these, so the site owner must have done this if this is an issue. I'd be happy to improve the filter.

Did any of this help find the cause?

@sybrew sybrew added the [Type] Support It's also a question, but a resolution is required. label Jul 4, 2024
@sybrew
Copy link
Owner

sybrew commented Jul 20, 2024

From other reports I've assimilated that there is a plugin active that calls the meta box before WordPress establishes what a post or page is. This meta box, with the SEO Bar embedded, tries to call a non-existing post object's metadata.

This shouldn't be a cause for concern, but it is a bug in another plugin, and it does indeed spawn unwanted errors.

These errors will no longer spawn from TSF v5.0.7 because we'll then always return the defaults: 5bf612f. It doesn't resolve the issue where the meta box is called for no good reason, however.

@sybrew sybrew closed this as completed Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Support It's also a question, but a resolution is required.
Projects
None yet
Development

No branches or pull requests

2 participants