Skip to content

Make sure '0' edge case is properly handled by is_json()#4635

Merged
gitlost merged 3 commits intowp-cli:masterfrom
kirtangajjar:upstream/patch-1
Jan 25, 2018
Merged

Make sure '0' edge case is properly handled by is_json()#4635
gitlost merged 3 commits intowp-cli:masterfrom
kirtangajjar:upstream/patch-1

Conversation

@kirtangajjar
Copy link
Contributor

No description provided.

Fixed wp-cli#4629 - Broken `0` edge case in `WP_CLI\Utils\is_json()`
@kirtangajjar kirtangajjar changed the title Upstream/patch 1 Make sure '0' edge case is properly handled by is_json() Jan 24, 2018
php/utils.php Outdated
*/
function is_json( $argument, $ignore_scalars = true ) {
if ( empty( $argument ) || ! is_string( $argument ) ) {
if ( ! is_string( $argument ) || '' === $argument ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the extra space after the equals will satisfy the wpcs sniff, so '' === $argument goes to '' === $argument (hard to see on github!).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Sorry I didn't notice it.

@gitlost gitlost added this to the 1.5.0 milestone Jan 24, 2018
@gitlost
Copy link
Contributor

gitlost commented Jan 24, 2018

Was #4634

@gitlost gitlost merged commit b32dfda into wp-cli:master Jan 25, 2018
@gitlost
Copy link
Contributor

gitlost commented Jan 25, 2018

Thanks very much @kirtangajjar !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants