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

Fix is_bool #34

Merged
merged 1 commit into from Jul 21, 2017

Conversation

Projects
None yet
3 participants
@aidy
Contributor

aidy commented Jul 21, 2017

is_bool uses UNIVERSAL::isa, which isn't now recommended.
This notably causes a problem with the string "JSON::PP::Boolean",
which it incorrectly identifies as a boolean value.

Fix by using ->isa("JSON::PP::Boolean") as recommended by perldoc.

Fix is_bool
is_bool uses UNIVERSAL::isa, which isn't now recommended.
This notably causes a problem with the string "JSON::PP::Boolean",
which it incorrectly identifies as a boolean value.

Fix by using ->isa("JSON::PP::Boolean") as recommended by perldoc.

@charsbar charsbar merged commit 4c7b77b into makamaka:master Jul 21, 2017

@charsbar

This comment has been minimized.

Show comment
Hide comment
@charsbar

charsbar Jul 21, 2017

Collaborator

Thanks!

Collaborator

charsbar commented Jul 21, 2017

Thanks!

rurban added a commit to rurban/Cpanel-JSON-XS that referenced this pull request Nov 20, 2017

Add is_bool test
see the upstream bug in makamaka/JSON-PP#34
where a wrong is_bool check casued the string "JSON::PP::Boolean"
to qualify is_bool returning true.
Thanks to http://blogs.perl.org/users/leo_lapworth/2017/11/metahack-2.html
@jwrightecs

This comment has been minimized.

Show comment
Hide comment
@jwrightecs

jwrightecs Nov 20, 2017

Shouldn't this be blessed rather than ref?
$ perl -MJSON::PP -e"print JSON::PP::is_bool({}) ? 'true' : 'false'"
Can't call method "isa" on unblessed reference at /home/jwright/perl5/lib/perl5/JSON/PP.pm line 1408.

jwrightecs commented Nov 20, 2017

Shouldn't this be blessed rather than ref?
$ perl -MJSON::PP -e"print JSON::PP::is_bool({}) ? 'true' : 'false'"
Can't call method "isa" on unblessed reference at /home/jwright/perl5/lib/perl5/JSON/PP.pm line 1408.

@charsbar

This comment has been minimized.

Show comment
Hide comment
@charsbar

charsbar Nov 20, 2017

Collaborator

@jwrightecs, thanks!

Collaborator

charsbar commented Nov 20, 2017

@jwrightecs, thanks!

rurban added a commit to rurban/Cpanel-JSON-XS that referenced this pull request Jan 6, 2018

Add is_bool test
see the upstream bug in makamaka/JSON-PP#34
where a wrong is_bool check casued the string "JSON::PP::Boolean"
to qualify is_bool returning true.
Thanks to http://blogs.perl.org/users/leo_lapworth/2017/11/metahack-2.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment