Skip Menu |

This queue is for tickets about the JSON CPAN distribution.

Report information
The Basics
Id: 69080
Status: rejected
Priority: 0/
Queue: JSON

People
Owner: Nobody in particular
Requestors: iank [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 2.50
  • 2.53
Fixed in: (no value)



$ perl -v This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi $ perl -MJSON -le 'print $JSON::VERSION' 2.53 I really don't know what's going on here. This might not be a bug for JSON, but it's a bug for -something- and I'd appreciate any help in tracking down the right something. When I decode_json some $var, then set $var to an undefined value, then decode_json the same $var, I get the first results back, as if $var hasn't changed (it has. I checked. I promise). Note that if I 'undef $var;' first, instead of '$var = <something returning an undefined value>', I get correct results (decode_json throws an exception). Test cases: This isn't right: perl -MJSON=decode_json -MData::Dumper -le 'sub blah { my $b; } my $a = "{\"a\":1}"; my $one = decode_json($a); print \$a; $a = blah(); print \$a; $two = decode_json($a); print Dumper($one); print Dumper($two);' SCALAR(0x125a948) SCALAR(0x125a948) $VAR1 = { 'a' => 1 }; $VAR1 = { 'a' => 1 }; This is just fine: $ perl -MJSON=decode_json -MData::Dumper -le 'my $a = "{\"a\":1}"; my $one = decode_json($a); print \$a; undef $a; print \$a; $two = decode_json($a); print Dumper($one); print Dumper($two);' SCALAR(0x11ecf10) SCALAR(0x11ecf10) malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "\x{0}\x{0}\x{0}\x{0}...") at -e line 1. I also tested this with 2.50.
I'm very sorry. This is a bug for JSON::XS.