#26030 [Opn->Ver]: array passed by reference is modified but should'nt be

From: Date: Wed, 29 Oct 2003 19:12:13 +0000
Subject: #26030 [Opn->Ver]: array passed by reference is modified but should'nt be
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-49623@lists.php.net to get a copy of this message
ID: 26030 Updated by: moriyoshi@php.net Reported By: kevin at hatry dot com -Status: Open +Status: Verified Bug Type: Scripting Engine problem -Operating System: windows + linux with php4.3.2 +Operating System: Irrelevant -PHP Version: 4.3.3 +PHP Version: Irrelevant New Comment: Related to bug #25996 Previous Comments: ------------------------------------------------------------------------ [2003-10-29 12:02:45] kevin at hatry dot com 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 this bug report at http://bugs.php.net/?id=26030&edit=1

« previous php.bugs (#49623) next »