Skip to content

Bug: Unique Array when array items are object fails #19

@povedica

Description

@povedica

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions