php-json-schema
php-json-schema copied to clipboard
Bug: Unique Array when array items are object fails
Please,
I think there is a bug, comparing unique array, when items are objects.
Consider: protected function checkUniqueItems($entity, $schema, $entityName) { if (isset($schema->uniqueItems) && $schema->uniqueItems) { if (count(array_unique($entity)) != count($entity)) {
With this: protected function checkUniqueItems($entity, $schema, $entityName) { if (isset($schema->uniqueItems) && $schema->uniqueItems) { if (count(array_unique($entity,SORT_REGULAR)) != count($entity)) {
Adding SORT_REGULAR (or perhaps depending on type of ites) flag on array_unique items
Thanks