ID:               31956
 Updated by:       [EMAIL PROTECTED]
 Reported By:      pillepop2003 at yahoo dot de
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      4CVS, 5CVS (2005-02-13)
 New Comment:

This happens with both PHP_4_3 and HEAD from today.
(only verified that it happens. I don't know if it's intentional or not
:)



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

[2005-02-13 17:27:23] pillepop2003 at yahoo dot de

Description:
------------
Bug #26030 realtes to the same problem and should be reopened: Why? It
seems to be *NOT* related to #25996, as formerly reported by
[EMAIL PROTECTED], which was the reason to close it.

Problem:
If a part of an array, that does not yet exist, is passed to a function
by reference, this part will be created automatically and filled with
NULL.

As long as no there is no function implemented to delete the NULL entry
(unset does not work), this behavior cannot be correct.

Please see my example - it clearly states that the behavior is
incorrect.

Reproduce code:
---------------
See why:
The following behavior *cannot* be intentional:

<?php
        function func(&$a)
        {
                // void();
        }
        
        $a['one'] =1;
        func($a['two']);
?>      

var_dump($a) returns

        array(2) {
                ["one"]=>
                int(1)
                ["two"]=>
                NULL
        }

Expected result:
----------------
array(2) {
                ["one"]=>
                int(1)
        }

Actual result:
--------------
array(2) {
                ["one"]=>
                int(1)
                ["two"]=>
                NULL
        }


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


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

Reply via email to