Skip Menu |

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

Report information
The Basics
Id: 72303
Status: resolved
Priority: 0/
Queue: JSON-Schema

People
Owner: perl [...] toby.ink
Requestors: LIEUTAR [...] cpan.org
Cc:
AdminCc:

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



Subject: Infinite loop when using "patternProperties".
Dear maintainers. I found a bug. This bug is simple, but critical. When I run following code. use Test::More tests => 1; use JSON::Schema; ok( JSON::Schema->new( +{ type => 'object', patternProperties => { foo => {type => 'integer'} } } )->validate({foo => 123}) ); I expected that this script would only display it as "ok", and would be finished. However, the script didn't stop. I searched the cause of problem in your modules, and I discovered it. The place of the problem is JSON/Schema/Helper.pm:428. The code of the line is following: 426: if (defined $patternProp) 427: { Show quoted text
428> while (my ($pattern, $scm) = %$patternProp)
429: { 430: $self->checkProp($value, $scm, $path, $i, $_changing) You try to iterate by simple substitution, however, the conditions of this loop will not change to an imitation by any means. Didn't you forget write calling the "each" function at the previous point of the hash dictionary? --- my environment: OS: Debian GNU/Linux 6.0.1 perl: 5.10.1
On 2011-11-09T05:29:37Z, LIEUTAR wrote: Show quoted text
> Didn't you forget write calling the "each" function > at the previous point of the hash dictionary?
Thanks - yes, it looks like "each" was forgotten. I'm planning a new release soon to add a requested feature, so I'll fix this bug too.
Fixed in JSON-Schema-0.011