I use the fruitful theme by fruitfulcode on my WordPress blog. After a recent change of environment, which meant that non-fatal PHP warnings would be displayed, I noticed warnings being displayed at the top of the blog
I navigated to the code highlighted in the warning (line 756 of inc/metaboxes/init.php) and found this
elseif ( is_array( $meta_box['pages'] ) && count( $meta_box['pages'] === 1 ) )
It is the second condition in this if statement that causes a problem. As we are invoking count on a boolean (the results of
$meta_box['pages'] === 1) rather than on an array or countable object PHP will emit this warning. I assume that the developer actually wanted to compare the number of pages to 1 and so I moved the close parenthesis so that we are invoking count on
$meta_box['pages'], which we know is an array from the first condition in the if statement.
elseif ( is_array( $meta_box['pages'] ) && count( $meta_box['pages'] ) === 1 )
After this code update the warnings disappeared. As I do not find it best practice to modify third party code I reverted my change and instead submitted it as a pull request to the fruitful theme developers.