ID: 25359
Updated by: [EMAIL PROTECTED]
Reported By: matschek at gmx dot de
-Status: Open
+Status: Verified
Bug Type: Arrays related
Operating System: *
-PHP Version: 4CVS
+PHP Version: 4CVS, 5CVS (2004-12-17)
Previous Comments:
------------------------------------------------------------------------
[2004-11-24 12:16:41] matschek at gmx dot de
Oops!
Now, both functions fail to work...
Result on WinXP with version "PHP/4.3.10RC2-dev":
---
function does_work():
Array
(
[0] => first
[1] => fifth
[2] => second
[3] => forth
[4] => third
)
function does_not_work():
Array
(
[0] => first
[1] => fifth
[2] => second
[3] => forth
[4] => third
)
---
------------------------------------------------------------------------
[2004-11-24 01:15:12] [EMAIL PROTECTED]
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2003-09-02 06:58:16] matschek at gmx dot de
Description:
------------
When using array_multisort in a funciton, and the array is set to
"global", array_multisort fails to sort the array.
Reproduce code:
---------------
function does_work() {
$data = array('first', 'fifth', 'second', 'forth', 'third');
$sort = array(1, 5, 2, 4, 3);
array_multisort($sort, $data);
print_r($data);
}
function does_not_work() {
global $data;
$data = array('first', 'fifth', 'second', 'forth', 'third');
$sort = array(1, 5, 2, 4, 3);
array_multisort($sort, $data);
print_r($data);
}
echo "function does_work():\n";
does_work();
echo "\n\nfunction does_not_work():\n";
does_not_work();
Expected result:
----------------
function does_work():
Array
(
[0] => first
[1] => second
[2] => third
[3] => forth
[4] => fifth
)
function does_not_work():
Array
(
[0] => first
[1] => second
[2] => third
[3] => forth
[4] => fifth
)
Actual result:
--------------
function does_work():
Array
(
[0] => first
[1] => second
[2] => third
[3] => forth
[4] => fifth
)
function does_not_work():
Array
(
[0] => first
[1] => fifth
[2] => second
[3] => forth
[4] => third
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25359&edit=1