#30082 [Opn->Ver]: Multidimensional arrays copy or array_multisort bug
| From: | sniper@php.net | Date: | Wed, 25 May 2005 09:30:55 +0000 |
| Subject: | #30082 [Opn->Ver]: Multidimensional arrays copy or array_multisort bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-79474@lists.php.net to get a copy of this message | ||
ID: 30082
Updated by: sniper@php.net
Reported By: techtonik@php.net
-Status: Open
+Status: Verified
Bug Type: Scripting Engine problem
Operating System: *
-PHP Version: 4.3.11
+PHP Version: 5CVS, 4CVS (2005-05-25)
Previous Comments:
------------------------------------------------------------------------
[2005-05-24 19:12:19] techtonik@php.net
Same behavior on 4.3.11
------------------------------------------------------------------------
[2004-12-02 01:00:02] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2004-11-24 01:14:36] sniper@php.net
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
------------------------------------------------------------------------
[2004-10-02 16:29:11] sniper@php.net
See also bug #30076
------------------------------------------------------------------------
[2004-09-14 10:39:26] techtonik@php.net
Description:
------------
Seems, that multidimensional arrays are copied with one dimension,
which contains references to other included arrays.
I haven't found any references in manual, so this must be a bug.
Reproduce code:
---------------
<?php
$a[0]['id'] = array(22, 12, 33, 55);
$a[0]['secid'] = array("a","b","c","d");
print_r($a);
$b = $a;
foreach ($b as $k => $v) {
array_multisort($v['id'], SORT_DESC, $v['secid'], SORT_DESC);
}
print_r($a);
?>
Expected result:
----------------
Array
(
[0] => Array
(
[id] => Array
(
[0] => 22
[1] => 12
[2] => 33
[3] => 55
)
[secid] => Array
(
[0] => a
[1] => b
[2] => c
[3] => d
)
)
)
Array
(
[0] => Array
(
[id] => Array
(
[0] => 22
[1] => 12
[2] => 33
[3] => 55
)
[secid] => Array
(
[0] => a
[1] => b
[2] => c
[3] => d
)
)
)
Actual result:
--------------
Array
(
[0] => Array
(
[id] => Array
(
[0] => 22
[1] => 12
[2] => 33
[3] => 55
)
[secid] => Array
(
[0] => a
[1] => b
[2] => c
[3] => d
)
)
)
Array
(
[0] => Array
(
[id] => Array
(
[0] => 55
[1] => 33
[2] => 22
[3] => 12
)
[secid] => Array
(
[0] => d
[1] => c
[2] => a
[3] => b
)
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30082&edit=1