Mantis - Quercus
Viewing Issue Advanced Details
1666 minor always 04-02-07 16:25 04-05-07 10:45
ddossot  
nam  
normal  
closed 3.1.1  
fixed  
none    
none 3.1.1  
0001666: Parsing error (in CakePHP controller.php script)
I had to modify this PHP code:

  $model =& new $this->modelClass($id);

to this form:

  $modelClass = $this->modelClass;
  $model =& new $modelClass($id);

as the first form is interpreted wrongly as being a call to $this->modelClass with the $id parameter instead of an instantiation of a new class named $this->modelClass, passing &id to its constructor.

Notes
(0001811)
nam   
04-04-07 23:35   
simplified test case

class FirstClass
{
  var $a = "FirstClass";

  function foo()
  {
    $b = "FirstClass";

    var_dump(new $this->a());
    var_dump(new $b());
  }
}

$first = new FirstClass();
$first->foo();
(0001816)
nam   
04-05-07 10:45   
php/09fj