#38607 [Opn->Bgs]: References in function

From: Date: Sat, 26 Aug 2006 10:50:54 +0000
Subject: #38607 [Opn->Bgs]: References in function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101363@lists.php.net to get a copy of this message
ID: 38607 Updated by: derick@php.net Reported By: kilgor at twojepc dot pl -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows/Linux PHP Version: 5.1.5 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . Previous Comments: ------------------------------------------------------------------------ [2006-08-26 10:21:15] kilgor at twojepc dot pl Description: ------------ PHP 5.1.1 is the last version of PHP which gave expected result of this statement. I noticed that next versions return wrong result. I tested PHP version 5.1.2, 5.1.4, 5.1.6 and the all returned unexpected (wrong) result. As you can see, the mistake appeares when you assign value to the variable which is passed to function as a reference: In my example: test($i=array()); Reproduce code: --------------- <? function test(&$x) { $x[]=1; $x[]=2; $x[]=3; } test($i=array()); $i[]=4; var_dump($i); ?> Expected result: ---------------- array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) } Actual result: -------------- array(1) { [3]=> int(4) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38607&edit=1

« previous php.bugs (#101363) next »