From: rodolfo at rodsoft dot org
Operating system: linux 2.6.6
PHP version: 5.0.0RC2
PHP Bug Type: Arrays related
Bug description: uasort and array_udiff doesn't work together
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
)
)
--
Edit bug report at http://bugs.php.net/?id=28739&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28739&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28739&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28739&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28739&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28739&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28739&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28739&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28739&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28739&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28739&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28739&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28739&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28739&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28739&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28739&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28739&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28739&r=float