wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Problem with options in class-wpseo-options.php

Open juhojama opened this issue 1 year ago • 1 comments

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

Please give us a description of what happened

Getting options is causing problems when $full_option is null. Adding a null check fixes it, but I don't know where the root cause is.

Error message:

Fatal error caught: 2 foreach() argument must be of type array|object, null given /var/www/vhosts/example.com/httpdocs/web/app/plugins/wordpress-seo/inc/options/class-wpseo-options.php 572\n', referer: https://example.com/wp/wp-login.php?redirect_to=https%3A%2F%2Fexample.com%2Fwp%2Fwp-admin%2F&reauth=1

Screenshots, screen recording, code snippet

Snippet from https://github.com/Yoast/wordpress-seo/blob/trunk/inc/options/class-wpseo-options.php#L572

	private static function get_lookup_table() {
		$lookup_table = [];

		foreach ( array_keys( static::$options ) as $option_name ) {
			$full_option = static::get_option( $option_name );
			foreach ( $full_option as $key => $value ) {
				$lookup_table[ $key ] = $option_name;
			}
		}

		return $lookup_table;
	}

More information coming... 🚧

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: Ubuntu
  • PHP version: 8.2
  • WordPress version: 6.4.2
  • WordPress Theme: custom
  • Yoast SEO version: 22.0
  • Gutenberg plugin version:
  • Elementor plugin version:
  • Classic Editor plugin version:
  • Relevant plugins in case of a bug: WC, Yoast Premium

juhojama avatar Feb 08 '24 14:02 juhojama

Hi @juhojama

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

As the details shared are very minimal, can you please share more details on reproducing this issue at our end? Also, could you let me know if you notice this error when viewing any specific pages? We hope you'll be able to share more details on this to help us better understand the issue.

We look forward to hearing from you and are happy to help you.

josevarghese avatar Feb 12 '24 08:02 josevarghese

Closing this issue due to inactivity. If the issue persists, please provide additional information so that we can investigate it further.

josevarghese avatar Mar 13 '24 06:03 josevarghese