#40737 [Fbk->Csd]: Variable passing by reference instead of copying.

From: Date: Tue, 06 Mar 2007 11:34:55 +0000
Subject: #40737 [Fbk->Csd]: Variable passing by reference instead of copying.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109975@lists.php.net to get a copy of this message
ID: 40737 User updated by: anter at voliacable dot com Reported By: anter at voliacable dot com -Status: Feedback +Status: Closed Bug Type: Class/Object related Operating System: XP Prof SP2 -PHP Version: 5.2.1 +PHP Version: 5.2.0 New Comment: I am sorry, I had version 5.2.0. In version 5.2.1 all works normally. Previous Comments: ------------------------------------------------------------------------ [2007-03-06 10:49:29] tony2001@php.net Cannot reproduce. Please make sure you've disabled all zend extensions like Zend Optimizer, eAccelerator, APC, IonCube etc. ------------------------------------------------------------------------ [2007-03-06 06:45:47] anter at voliacable dot com Description: ------------ In the Simple::$var property the reference to a variable instead of a copy is located, depending on many conditions. If lines 6 and 8 of bug.php to change places the expected result is received. If to remove a line 7 of bug.php the expected result is received. If remove a line 1 of bug.php and to place contents of a Simple.php in a bug.php the expected result is received. Reproduce code: --------------- <file Simple.php> 1 class Simple 2 { 3 protected static $var; 4 5 public static function setVar($value) 6 { 7 self::$var = $value; 8 } 9 } <file bug.php> 1 require_once('Simple.php'); 2 3 $var1 = 'value1'; 4 $var2 = 'value2'; 5 6 Simple::setVar($var1); 7 8 class VerySimple extends Simple {} 9 10 Simple::setVar($var2); 11 12 print $var1; Expected result: ---------------- value1 Actual result: -------------- value2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40737&edit=1

« previous php.bugs (#109975) next »