From:             scott dot pascoe at gmail dot com
Operating system: Windows XP
PHP version:      5.2.1RC3
PHP Bug Type:     Scripting Engine problem
Bug description:  Test showing Bug 39449 isn't totally fixed yet

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 bug report at http://bugs.php.net/?id=40216&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40216&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40216&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40216&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40216&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40216&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40216&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40216&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40216&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40216&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40216&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40216&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40216&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40216&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40216&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40216&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40216&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40216&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40216&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40216&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40216&r=mysqlcfg

Reply via email to