From:             [EMAIL PROTECTED]
Operating system: W2K
PHP version:      4.3.8
PHP Bug Type:     Arrays related
Bug description:  Multidimensional arrays copy or array_multisort bug

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 bug report at http://bugs.php.net/?id=30082&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30082&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30082&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30082&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30082&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30082&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30082&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30082&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30082&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30082&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30082&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30082&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30082&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30082&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30082&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30082&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30082&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30082&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30082&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30082&r=mysqlcfg

Reply via email to