Skip to content

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

Description

@nobleclem

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions