Skip to content

Broken 0 edge case in WP_CLI\Utils\is_json() #4629

@schlessera

Description

@schlessera

In the following code, the check will return the wrong result in the case of $argument being 0:

if ( empty( $argument ) || ! is_string( $argument ) ) {

The check should rather be like this:

if ( ! is_string( $argument ) || 0 === strlen( $argument ) ) {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions