Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect if() expression operator used in composer-includes/bu-navigation-core-widget/src/data-format.php#L171 #106

Open
nobleclem opened this issue Sep 14, 2021 · 0 comments

Comments

@nobleclem
Copy link
Contributor

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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant