From:             kevin at hatry dot com
Operating system: windows + linux with php4.3.2
PHP version:      4.3.3
PHP Bug Type:     Scripting Engine problem
Bug description:  array passed by reference is modified but should'nt be

Description:
------------
When passing a non-existing portion of an array by reference this portion
gets created even if the function does not touch the array => it is
modified in the calling line.

It works with string indexes as well.

Reproduce code:
---------------
error_reporting(E_ALL);

$tab2 = array( );

function do_nothing ( &$var ) { 
// code here doesnt matter
}

do_nothing($tab2[10]);
var_dump($tab2);



Expected result:
----------------
array(0) {
}


Actual result:
--------------
array(1) {
  [10]=>
  NULL
}


-- 
Edit bug report at http://bugs.php.net/?id=26030&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26030&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26030&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26030&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26030&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26030&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26030&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26030&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26030&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26030&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26030&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26030&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26030&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26030&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26030&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26030&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26030&r=float

Reply via email to