ID: 30179
User updated by: oliver at teqneers dot de
Reported By: oliver at teqneers dot de
Status: Bogus
Bug Type: Arrays related
Operating System: Suse 9.0
PHP Version: 4.3.8
New Comment:
This is definately no BOGUS. If you like i can send you
screenshots or the output of the phpinfo(). You can ask
Hartmut Holzgraefe about me. I used to work with him and
I am programming PHP for years. This is a bug and it
does happen everytime I execute this tiny script.
I sent in live output data.
Previous Comments:
------------------------------------------------------------------------
[2004-09-22 00:04:44] [EMAIL PROTECTED]
Works fine here with 4.3.6, 4.3.8, 4.3.9-dev, 5.0.1 and 5.1.0-dev.
------------------------------------------------------------------------
[2004-09-21 15:50:47] oliver at teqneers dot de
Description:
------------
When I copy an array with a normal "=" the copy is not a real copy, but
a reference to it. This only seems to happen to cascaded arrays.
When an entry of the original array is unset, the copied entry will be
unset as well.
Reproduce code:
---------------
$arr = array( 'in' => array(1,2,3) );
$copy = $arr;
print_r($copy);
unset( $arr['in'][1] );
print_r($copy);
Expected result:
----------------
Array
(
[in] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
Array
(
[in] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
Actual result:
--------------
Array
(
[in] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
Array
(
[in] => Array
(
[0] => 1
[2] => 3
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30179&edit=1