Skip Menu |

This queue is for tickets about the JSON-PP CPAN distribution.

Report information
The Basics
Id: 86948
Status: resolved
Priority: 0/
Queue: JSON-PP

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

Bug Information
Severity: Critical
Broken in: 2.27202
Fixed in: (no value)



Subject: precedence error (return/or) in _incr_parse
At the end of sub _incr_parse (JSON::PP line 1567), it says: return $obj or ''; Due to the low precedence of 'or', this is parsed as "(return $obj) or ''", which is equivalent to 'return $obj'. This should probably use '||' instead.
On Mon Jul 15 16:46:30 2013, MAUKE wrote: Show quoted text
> At the end of sub _incr_parse (JSON::PP line 1567), it says: > > return $obj or ''; > > Due to the low precedence of 'or', this is parsed as "(return $obj) or > ''", which is equivalent to 'return $obj'. > > This should probably use '||' instead.
I have patch JSON::PP directly in bleadperl, in commit 4fa6bcb02f1. I bumped the version to 2.27202_01 in commit 914881f4ac. I would appreciate it if there could be a new CPAN release soon, to keep things in synch. Attached is 4fa6bcb02f1, modified to apply cleanly to the CPAN dist.
Subject: open_W88Txk9i.txt
From 4fa6bcb02f19f2a9cecab11a6b29ed4adbe7a437 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos <sprout@cpan.org> Date: Sun, 15 Sep 2013 13:37:56 -0700 Subject: [PATCH] Fix precedence issue in JSON::PP diff --git a/lib/JSON/PP.pm b/cpan/JSON-PP/lib/JSON/PP.pm index e9e65b1..12b7d51 100644 --- a/lib/JSON/PP.pm +++ b/lib/JSON/PP.pm @@ -1564,7 +1564,7 @@ sub _incr_parse { $self->{incr_text} = substr( $self->{incr_text}, $p ); $self->{incr_p} = 0; - return $obj or ''; + return $obj || ''; }
This is now a fairly critical bug. We have fixed it in perl5.git, in JSON/PP.pm, but if a user then installs JSON.pm, they get the broken old version. This causes a warning, which breaks tests that assert there must not be warnings. A new release, even with only this fix, would be greatly appreciated. -- rjbs
On 2013-10-16 07:47:16, RJBS wrote: Show quoted text
> This is now a fairly critical bug. We have fixed it in perl5.git, in > JSON/PP.pm, but if a user then installs JSON.pm, they get the broken > old version. This causes a warning, which breaks tests that assert > there must not be warnings. > > A new release, even with only this fix, would be greatly appreciated.
07:46 <@BinGOs> https://metacpan.org/source/MAKAMAKA/JSON-2.59/lib/JSON/backportPP.pm#L1573 has the same problem -- rjbs
Sorry for my late reply. I just released fixed JSON and JSON::PP. Thanks,