From:             pillepop2003 at yahoo dot de
Operating system: 
PHP version:      4.3.10
PHP Bug Type:     Scripting Engine problem
Bug description:  array passed by reference is modified but should'nt be

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

Reply via email to