|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 Patchesbug62977.patch (last revision 2012-08-30 15:52 UTC by laruence@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits              [2012-08-30 14:34 UTC] laruence@php.net
 
-Assigned To:
+Assigned To: laruence
  [2012-08-30 15:52 UTC] laruence@php.net
  [2012-08-30 17:27 UTC] cataphract@php.net
  [2012-08-31 03:41 UTC] laruence@php.net
  [2012-08-31 04:08 UTC] laruence@php.net
  [2017-05-04 17:26 UTC] peehaa@php.net
 
-Package: Class/Object related
+Package: Date/time related
  [2018-03-12 12:29 UTC] cmb@php.net
  [2018-10-13 06:20 UTC] jhdxr@php.net
 
-Status:      Assigned
+Status:      Closed
-Assigned To: laruence
+Assigned To: jhdxr
  [2018-10-13 06:20 UTC] jhdxr@php.net
 | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 19:00:02 2025 UTC | 
Description: ------------ array_unique() returns duplicates for array which contains objects with DateTime instances. Test script: --------------- <?php class Foo { public $dt; function __construct($dt) { $this->dt = $dt; } } $foo = new Foo(new DateTime); $std = new stdClass; $arr = [$foo, $foo, $std, $std, $std]; var_dump(array_unique($arr, SORT_REGULAR)); Expected result: ---------------- array(4) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(19) "2012-08-30 15:18:01" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Prague" } } [2]=> object(stdClass)#3 (0) { } } Actual result: -------------- array(4) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(19) "2012-08-30 15:18:01" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Prague" } } [1]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(19) "2012-08-30 15:18:01" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Prague" } } [2]=> object(stdClass)#3 (0) { } [4]=> object(stdClass)#3 (0) { } }