Yoast / wordpress-seo

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

PHP Notices after updating to 16.1.1 #16879

Open romancieciuch opened 3 years ago

romancieciuch commented 3 years ago

Hello there!

I've got a bug after updating to 16.1.1.

Got notices pasted below:

Notice: Trying to access array offset on value of type bool in /www/wp-content/plugins/wordpress-seo/src/helpers/schema/image-helper.php on line 98

Notice: Trying to access array offset on value of type bool in /www/wp-content/plugins/wordpress-seo/src/helpers/schema/image-helper.php on line 100

Notice: Trying to access array offset on value of type bool in /www/wp-content/plugins/wordpress-seo/src/helpers/schema/image-helper.php on line 101

I have found out that:

/www/wp-content/plugins/wordpress-seo/src/helpers/schema/image-helper.php on line 96 there should be an if-statement, as we have to double check whether the array or NULL was passed.

This solution works:

if (empty($attachment_meta)) return false;

Use my code or please use your own to fix the problem.

Thank you.

Djennez commented 3 years ago

@romancieciuch I found that the calls to that function either don't trigger, or have the correct arguments. Can you tell me your settings from SEO -> Search Appearance -> Knowledge Graph & Schema.org? So are you using person or organization and twat is the used data?

romancieciuch commented 3 years ago

I have chosen: Organization

And the data is: Name: dbay.pl Logo: File in SVG

Djennez commented 3 years ago

Ah, right. It's the SVG that is causing this to fail. As a workaround you can set a png / jpg as a logo. I am not sure if / when we'll support svgs here.

romancieciuch commented 3 years ago

OK, will do.

Thank you, sir! :)

wpsumo commented 3 years ago

@Djennez SVG is not supported as organization logotype in wp admin by Yoast?

Djennez commented 3 years ago

SVG is not supported as organization logotype in wp admin by Yoast?

No, it currently isn't (I don't know the reasoning behind this). SVGs aren't supported as uploadable filetypes (by default) in WordPress either.

wpsumo commented 3 years ago

@Djennez Okay, it's very common these days to use vector graphics for logotypes and other media. It's not natively supported, but it is a format google support, so I still consider it important to support. Many users allow uploading of SVG files via plugins as they are sanitized before.

gcPhil commented 2 years ago

I noticed a related issue: I used a SVG-File as Logo (uploaded and used without problems last year, before Yeast SEO version 16.1.1.). When I now (in version 18.2) tried to save some OTHER setting in the “Search Appearance” Settings area it results in this error message on the frontend: Warning: Undefined array key “url” in /[MY-CENSORED-URL]/wp-content/plugins/wordpress-seo/src/helpers/schema/image-helper.php on line 98

It took several weeks until I found out that the SVG Logo file causes this. Changing to a JPG Logo worked as a workaround but it would be great if this could get fixed and SVG files would work again (or at least would produce a clear understandable error message in the backend instead of breaking the frontend.)