Skip Menu |

This queue is for tickets about the JSON CPAN distribution.

Report information
The Basics
Id: 84154
Status: resolved
Priority: 0/
Queue: JSON

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

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



Subject: Test t/19_incr.t fails under Perl 5.17.10
The problem appears to be that, for security reasons, Perl 5.17.10 randomizes hash traversal order on a per-hash basis, so that two identical hashes will no longer be (necessarily) traversed in the same order. The failing tests appear to be round-trip tests that assume if two hashes contain the same data, they will be traversed in the same order. The attached patch appears to address this problem, by calling canonical() on the JSON objects.
Subject: JSON.patch
--- t/19_incr.old 2010-12-20 02:41:45.000000000 -0500 +++ t/19_incr.t 2013-03-22 17:57:34.000000000 -0400 @@ -34,10 +34,10 @@ -splitter +JSON->new , ' ["x\\"","\\u1000\\\\n\\nx",1,{"\\\\" :5 , "": "x"}]'; -splitter +JSON->new , '[ "x\\"","\\u1000\\\\n\\nx" , 1,{"\\\\ " :5 , "": " x"} ] '; -splitter +JSON->new->allow_nonref, '"test"'; -splitter +JSON->new->allow_nonref, ' "5" '; +splitter +JSON->new->canonical , ' ["x\\"","\\u1000\\\\n\\nx",1,{"\\\\" :5 , "": "x"}]'; +splitter +JSON->new->canonical , '[ "x\\"","\\u1000\\\\n\\nx" , 1,{"\\\\ " :5 , "": " x"} ] '; +splitter +JSON->new->allow_nonref->canonical, '"test"'; +splitter +JSON->new->allow_nonref->canonical, ' "5" ';
I fixed. Thanks!