php-json-schema icon indicating copy to clipboard operation
php-json-schema copied to clipboard

Bug: Unique Array when array items are object fails

Open povedica opened this issue 9 years ago • 0 comments

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

povedica avatar Jun 14 '16 10:06 povedica