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
[X] I've searched for any related issues and avoided creating a duplicate issue.
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?
I don't know yeat, because I need to understand why the active plugins list is returned false
Technical info
If relevant, which editor is affected (or editors):
[ ] Classic Editor
[X] Gutenberg
[ ] Classic Editor plugin
Which browser is affected (or browsers):
[X] Chrome
[ ] Firefox
[ ] Safari
[ ] Other
Used versions
WordPress version: 5.3.2 (pt_br)
Yoast SEO version: 13.0
Gutenberg plugin version:
Classic Editor plugin version:
Relevant plugins in case of a bug:
Tested with theme: Sparkling (child modificaation) by Colorlib.com
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.
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?
Technical info
Used versions