#40216 [Fbk->Opn]: Test showing Bug 39449 isn't totally fixed yet

From: Date: Wed, 24 Jan 2007 13:24:37 +0000
Subject: #40216 [Fbk->Opn]: Test showing Bug 39449 isn't totally fixed yet
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107970@lists.php.net to get a copy of this message
ID: 40216 User updated by: scott dot pascoe at gmail dot com Reported By: scott dot pascoe at gmail dot com -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Windows XP PHP Version: 5.2.1RC3 New Comment: Sorry, I hacked too much out of it to make it be very small. Replacing the '$ns' references with "'test'" will make it work. Scott Previous Comments: ------------------------------------------------------------------------ [2007-01-24 09:27:25] tony2001@php.net This code does not work at all: Parse error: syntax error, unexpected '&' in /tmp/4.php on line 8 Notice: Undefined variable: ns in /tmp/4.php on line 11 ------------------------------------------------------------------------ [2007-01-24 05:39:21] scott dot pascoe at gmail dot com Description: ------------ The reproduce code is in a test format. In php 5.1.4, it outputs the expected output, it does not in 5.2.0, or does it in the 5.2.1 snapshot from today. It was reported to be fixed on 2007-01-10, but isn't yet. The symfony framework depends upon this capability. Reproduce code: --------------- --TEST-- Bug #39449 (Behavior changed from php 5.1.4 to 5.2.0) --FILE-- <?php // hacked for this test $ns = 'test'; class ParameterHolder { protected $parameters = array(); public function & get($name) { return & $this->parameters[$ns][$name]; } public function setByRef($name, & $value) { if (!isset($this->parameters[$ns])) $this->parameters[$ns] = array(); $this->parameters[$ns][$name] =& $value; } } class Bug39449 { protected $varHolder = null; public function __construct() { $this->varHolder = new ParameterHolder(); } public function getVarHolder() { return $this->varHolder; } public function __set($key, $value) { return $this->varHolder->setByRef($key, $value); } public function __get($key) { return $this->varHolder->get($key); } } $b = new Bug39449(); $b->foo = Array(); $b->foo[0] = 'bar'; foreach ($b->foo as $k => $v) { echo "$k => $v\n"; } ?> --EXPECT-- 0 => bar Expected result: ---------------- 0 => bar Actual result: -------------- [nothing] ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40216&edit=1

« previous php.bugs (#107970) next »