bu-navigation
bu-navigation copied to clipboard
Incorrect if() expression operator used in composer-includes/bu-navigation-core-widget/src/data-format.php#L171
plugin version: 1.3.3 php version: 7.4 file: composer-includes/bu-navigation-core-widget/src/data-format.php#L171 function: pages_by_parent
the current if is written as
if ( ! is_array( $pages ) && ! count( $pages ) > 0 ) {
return array();
}
However if $pages is say an empty string then the first expression is true but the second is false and throws an PHP warning "count(): Parameter must be an array or an object that implements Countable"
I think the statement should be written as
if ( ! is_array( $pages ) || ! count( $pages ) > 0 ) {
return array();
}