Closed
Description
I've found an issue, with some schema, the validator will go into an infinite loop and eventually terminate when the allowed memory is exhausted, you can reproduce the issue with this code :
<?php
include_once __DIR__."/../vendor/autoload.php";
$validator = new \JsonSchema\Validator();
$data = [];
$schema = (object)['$ref' => 'http://json-schema.org/draft-04/schema'];
echo __LINE__, PHP_EOL;
$validator->validate($data, $schema);
echo __LINE__, PHP_EOL;
$validator->validate($data, $schema, \JsonSchema\Constraints\Constraint::CHECK_MODE_APPLY_DEFAULTS);
echo __LINE__, PHP_EOL;
I'm not sure yet what is causing this. I'll guess a infinite recursion has been introduced in UndefinedConstraint::validateCommonProperties. I'll try to make another reproduction of the bug with a smaller schema
Metadata
Metadata
Assignees
Labels
No labels