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