Skip to content

Fix is_bool #34

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

Merged
merged 1 commit into from
Jul 21, 2017
Merged

Fix is_bool #34

merged 1 commit into from
Jul 21, 2017

Conversation

aidy
Copy link
Contributor

@aidy 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.

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
Copy link
Collaborator

Thanks!

rurban added a commit to rurban/Cpanel-JSON-XS that referenced this pull request Nov 20, 2017
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
Copy link

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
Copy link
Collaborator

@jwrightecs, thanks!

rurban added a commit to rurban/Cpanel-JSON-XS that referenced this pull request Jan 6, 2018
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants