mirror of
https://github.com/justinrainbow/json-schema.git
synced 2025-05-04 21:48:42 +02:00
Make the enum element comparison strict
The current check is matching numeric strings that are not equal ( like "604.1" == "604.10" because of PHP's == behavior that converts numeric strings to numbers and then performs a numeric comparison), even if type is checked before the comparison, the value should be identic
This commit is contained in:
parent
87b54b460f
commit
33c5c616d7
@ -28,11 +28,11 @@ class Enum extends Constraint
|
||||
}
|
||||
|
||||
foreach ($schema->enum as $enum) {
|
||||
if ((gettype($element) === gettype($enum)) && ($element == $enum)) {
|
||||
if ((gettype($element) === gettype($enum)) && ($element === $enum)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->addError($path, "does not have a value in the enumeration " . print_r($schema->enum, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user