ID: 33763
Updated by: [EMAIL PROTECTED]
Reported By: marceloburegio at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Fedora Core 4 and Windows 2000
PHP Version: 5.0.4
New Comment:
This is duplicate of bug #25359.
Behavior is different but reason exactly the same.
array_multisort() - recieves array by value and wotk with tham as with
references.
Previous Comments:
------------------------------------------------------------------------
[2005-07-19 06:28:28] marceloburegio at gmail dot com
Description:
------------
Using array_multisort() in a function with copy of local array, this
affects the original array.
It's same to bug #32031
I solve this changing the code:
$arrSort = $arr;
to:
$arrSort = $arr + array();
Reproduce code:
---------------
function bug_array($arr) {
$arrSort = $arr;
array_multisort($arrSort);
}
$arr = array(1, 0);
print_r($arr);
bug_array($arr);
print_r($arr);
Expected result:
----------------
Array
(
[0] => 1
[1] => 0
)
Array
(
[0] => 1
[1] => 0
)
Actual result:
--------------
Array
(
[0] => 1
[1] => 0
)
Array
(
[0] => 0
[1] => 1
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33763&edit=1