|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-11 17:06 UTC] rodolfo at rodsoft dot org
[2004-07-11 21:23 UTC] andrey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ If you call uasort with one callback function and then call array_udiff with another callback function, this last call will use first's callback. If we first call array_udiff and then call uasort, everything goes well. Reproduce code: --------------- <? class p { public $x; function __construct($x){$this->x=$x;} } function a(&$a, &$b){return $a->x - $b->x;} function b(&$a, &$b){return $a->y - $b->y;} $p1 = array(new p(2), new p(1), new p(0)); $p2 = array(new p(0), new p(2), new p(3)); uasort($p1, 'a'); print_r($p1); echo "\n"; print_r(array_udiff($p1,$p2, 'b')); ?> Expected result: ---------------- Notice: Undefined property: p::$y in tst.php on line 8 Actual result: -------------- Array ( [2] => p Object ( [x] => 0 ) [1] => p Object ( [x] => 1 ) [0] => p Object ( [x] => 2 ) ) Array ( [1] => p Object ( [x] => 1 ) )