Yoast / wordpress-seo

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

FIXED: Warning: in_array() expects parameter 2 to be array, boolean given in .../plugins/wordpress-seo/admin/class-yoast-plugin-conflict.php on line 269 #14379

Open fnorte opened 4 years ago

fnorte commented 4 years ago

Please give us a description of what happened.

In my development enviroment in a multisite installation, one of the sites report this warning: Warning: in_array() expects parameter 2 to be array, boolean given in (...)/plugins/wordpress-seo/admin/class-yoast-plugin-conflict.php on line 269

Following the code I realized that the object in line #74, is retrive a boll(false) instead an array , necessary in the line that occured the Warning : $this->all_active_plugins = get_option( 'active_plugins' );

the unknow reason, that I need personally investigate is why this wordpress base function "get_option", that supposed to list the active plugins is empty.

Please describe what you expected to happen and why.

Since the possibility of this false response in that funcion, for safety I decided to change the bollean false response to put this type inside an array to avoid this warning, when this object is used in a necessary array type variable, change this line to this: $this->all_active_plugins = (array) get_option( 'active_plugins', array() );

How can we reproduce this behavior?

  1. I don't know yeat, because I need to understand why the active plugins list is returned false

Technical info

Used versions

Djennez commented 4 years ago

Hi @fnorte and thanks for the report. You're right, we should check for an array here. I'll mark this as a valid bug report, though not one with high priority.