Mantis - Quercus
Viewing Issue Advanced Details
2837 minor always 08-12-08 07:53 08-14-08 10:38
wikipo  
nam  
normal  
closed 3.2.0  
fixed  
none    
none 3.2.1  
0002837: argument by reference and self::
When calling a class method with the self::method syntax, the arguments passed by reference are not updated on return.

For example, in
<?php

 class test
{
 function f1(&$str)
 {
     $str = "text";
 }
 function f2()
 {
    $str = "";
    self::f1($str);
    echo "result: ";
    echo $str;
 }
}
$b = new test();
$b->f2();
?>

displays: "result: " (insted of "result: text")



I modified the code in ClassMethodExpr/eval(),

subsituting: values[i] = _args[i].eval(env);
with: values[i] = _args[i].evalArg(env);

and it seems to correct this issue.

Notes
(0003332)
nam   
08-14-08 10:38   
php/09e1
php/39e1