ID:               45708
 Updated by:       [EMAIL PROTECTED]
 Reported By:      watermark86 at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: ubuntu 8.04
 PHP Version:      5.2.6
 New Comment:

Quite expected: $row is still reference to that one entry. You modify
it to 0 in the for() clause..


Previous Comments:
------------------------------------------------------------------------

[2008-08-04 13:42:56] watermark86 at gmail dot com

Description:
------------
uasort overwrites the last element in a large associative array with
incrementing numbers

Reproduce code:
---------------
$detaildata = array();
for($i = 0; $i < 6; $i++) {
        $lid = rand(1,200);
        $numpeople = rand(0,12);
        
        for($p = 0; $p < $numpeople; $p++) {
                $pid = rand(1,200);
                $detaildata[$lid][$pid] = array("string data","string 
data",$pid);
        }
}
$detaildata[9][44] = array("string data","string data",44);
//
foreach($detaildata as &$row) {
        uasort($row,CalSortCallback);
}
//
echo is_array($detaildata[9])?'yes':'no';
for($row = 0; $row < 5; $row++) {
        echo is_array($detaildata[9])?'yes':$detaildata[9];
}
//
function CalSortCallback($a,$b) {
        return strcmp($a[1],$b[1]);
}

Expected result:
----------------
it should print 6 yeses

yesyesyesyesyesyes

Actual result:
--------------
it prints yes01234


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


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

Reply via email to