|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-12-11 20:55 UTC] aharvey@php.net
-Status: Open
+Status: Not a bug
[2013-12-11 20:55 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 16:00:01 2025 UTC |
Description: ------------ Hopefully the test script is self-explanatory. When running array_intersect on arrays that contains an object that mutates itself and the return value in its __toString() method, the result is an empty array even if there are literal values in the arrays that intersect. Test script: --------------- <?php class A { protected $i = 0; public function __toString() { $this->i++; return "$this->i"; } } $a = new A; $b = ['100', $a]; var_dump(array_intersect($b, $b)); Expected result: ---------------- array(1) { [0]=> string(3) "100" } Actual result: -------------- array(0) { }