plugin.php and wp_filter causing an infinite loop
-
Hi,
We have noticed two recent cases of an infinite loop in the plugin.php code.
PHP Warning: reset() expects parameter 1 to be array, boolean given in /wp_dir/wp-includes/plugin.php on line 400 PHP Warning: current() expects parameter 1 to be array, boolean given in /wp_dir/wp-includes/plugin.php on line 403 next() expects parameter 1 to be array, boolean given in /wp_dir/wp-includes/plugin.php on line 407 PHP Warning: current() expects parameter 1 to be array, boolean given in /wp_dir/wp-includes/plugin.php on line 403 next() expects parameter 1 to be array, boolean given in /wp_dir/wp-includes/plugin.php on line 407 -- infinity --
Not sure why $wp_filter[$tag] is getting set to a boolean, but there is no check in the code to make sure it is an array before this loop is entered:
do { foreach ( (array) current($wp_filter[$tag]) as $the_ ) if ( !is_null($the_['function']) ) call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); } while ( next($wp_filter[$tag]) !== false );
We support many sites so it is hard to pin down what has changed. We will do more debugging to see if we can find what is causing the issue.
I wrote mainly because I think it is sort of dangerous to have this type of a loop given you don’t always know that the thing coming in is truly an array. Perhaps a future version of WP could include a check for an array first? I notice this looping construct exists in several other places in plugin.php.
Thanks for creating such a terrific product. I’d be happy to provide any additional information if needed.
- The topic ‘plugin.php and wp_filter causing an infinite loop’ is closed to new replies.