Req #79890 [Opn->Dup]: array_unique does not allow strict comparison

From: Date: Thu, 13 Aug 2020 09:34:45 +0000
Subject: Req #79890 [Opn->Dup]: array_unique does not allow strict comparison
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228565@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79890&edit=1

 ID:                 79890
 Updated by:         nikic@php.net
 Reported by:        michael dot vorisek at email dot cz
 Summary:            array_unique does not allow strict comparison
-Status:             Open
+Status:             Duplicate
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   any
 PHP Version:        7.4.8
 Block user comment: N
 Private report:     N

 New Comment:

Duplicate of bug #65208.


Previous Comments:
------------------------------------------------------------------------
[2020-07-23 15:26:51] michael dot vorisek at email dot cz

Description:
------------
this should be definitely supported, probably with SORT_UNIQUE_STRICT constant.

currently, there is not simple way to remove same instance duplicates

Test script:
---------------
$d = new \DateTime('2000-1-1');
print_r(
    array_unique([$d, $d, new \DateTime('2000-1-1')], SORT_REGULAR)
);

Expected result:
----------------
array with 2 DateTime elements

Actual result:
--------------
remove same instance duplicates - not supported by array_unique


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79890&edit=1


Thread (2 messages)

« previous php.bugs (#228565) next »