Edit report at https://bugs.php.net/bug.php?id=61462&edit=1

 ID:                 61462
 Comment by:         goetas at lignano dot it
 Reported by:        goetas at lignano dot it
 Summary:            array references inconsistency
 Status:             Open
 Type:               Bug
 Package:            Arrays related
 Operating System:   ubuntu
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

i've also tested modifying the "remTest" function...

function remTest($array){
        unset($array['a']);
}

with this function the code works correctly...
really strange...


Previous Comments:
------------------------------------------------------------------------
[2012-03-21 10:13:08] goetas at lignano dot it

Description:
------------
i've found this array reference problem.
 

Test script:
---------------
function remTest($array){
        unset($array['a'][0]);
}

$a = array(
        'a'=> array(0=>'test')
);

$b = &$a['a'];


print_r($a);

remTest($a);

print_r($a);

Expected result:
----------------
Array
(
    [a] => Array
        (
            [0] => test
        )

)
Array
(
    [a] => Array
        (
            [0] => test
        )

)

Actual result:
--------------
Array
(
    [a] => Array
        (
            [0] => test
        )

)
Array
(
    [a] => Array
        (
        )

)



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



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

Reply via email to