ID:               28734
 User updated by:  tomas_matousek at hotmail dot com
 Reported By:      tomas_matousek at hotmail dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: WinXP
 PHP Version:      5.0.0RC2
 New Comment:

Don't know how that is possible in your version of PHP 5.0.0 RC3, but
in mine (I'm testing RC3 available on www.php.net not the latest
version from CVS) the bug is still there (result is the same as I
described in "Actual Result").


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

[2004-06-11 01:43:58] D dot Kingma at jool dot nl

Results on RC3:

Array
(
    [0] => 1
    [1] => Z
    [2] => 3
    [3] => 4
    [4] => Array
        (
            [0] => 1
            [1] => Z
            [2] => 3
            [3] => 4
            [4] => Array
 *RECURSION*
        )

)

Seems as aspected results

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

[2004-06-10 20:46:39] tomas_matousek at hotmail dot com

Description:
------------
Create an array $b and set some of its item to reference the array
itself by =& operator. Then assign this array to some other variable.
This assignment (*) makes something wrong in the array $b because if
you change $b's items after this assignment the structure of array $b
is changed.
However, if that assignment (*) doesn't take place the behavior is
correct.



Reproduce code:
---------------
$b = array(1,2,3,4);
$b[4] =& $b;

// this assignment probably makes changes to $b's structure
$c = $b;             

$b[1] = 'X';
$b[4][1] = 'Y';
$b[4][4][1] = 'Z';

print_r($b);


Expected result:
----------------
Array
(
    [0] => 1
    [1] => Z
    [2] => 3
    [3] => 4
    [4] => Array
 *RECURSION*
)

Actual result:
--------------
Array
(
    [0] => 1
    [1] => X
    [2] => 3
    [3] => 4
    [4] => Array
        (
            [0] => 1
            [1] => Y
            [2] => 3
            [3] => 4
            [4] => Array
                (
                    [0] => 1
                    [1] => Z
                    [2] => 3
                    [3] => 4
                    [4] => Array
                        (
                            [0] => 1
                            [1] => 2
                            [2] => 3
                            [3] => 4
                            [4] => Array
 *RECURSION*
                        )

                )

        )
)


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


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

Reply via email to