Mantis - Quercus
Viewing Issue Advanced Details
3210 minor always 12-30-08 09:01 01-04-09 16:54
ferg  
ferg  
urgent  
closed 4.0.0  
fixed  
none    
none 4.0.0  
0003210: array reference issue
(rep by koreth)

Code is something like the following, where $stack gets modified by the yystack assignment.

class A {
  public $yystack = array("a", "b");
  public $yyindex = 0;

  function bar()
  {
    $x =& $this->yystack;
  }

  function foo()
  {
    $stack = $this->yystack;

    $x = new C;
    $this->yystack[$this->yyindex++] = $x;

    return $stack;
  }
}

Notes
(0003686)
ferg   
12-30-08 09:25   
php/04a8
(0003694)
ferg   
01-04-09 16:53   
php/34a9 for the specific code.

The general case is not solvable in Quercus, because PHP's references are implemented by reference count, which Quercus does not do. So there are situations where PHP will create a reference and remove it, and Quercus will create a reference, but not be able to remove the reference.

Since array copies behave differently for references vs array values, this difference between Apache PHP and Quercus will need to be resolved on a case-by-case basis.