PHP 4.0 Bug #2753: Cannot return references from functions
| From: | duncan at emarketeers dot com | Date: | Thu, 18 Nov 1999 12:54:46 +0000 |
| Subject: | PHP 4.0 Bug #2753: Cannot return references from functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12718@lists.php.net to get a copy of this message | ||
From: duncan@emarketeers.com
Operating system: Linux 2.2.9 (RedHat 6.0)
PHP version: 4.0 Beta 3
PHP Bug Type: Scripting Engine problem
Bug description: Cannot return references from functions
It is not possible to return a reference from a function, the parser reports
return &$x;
as a syntax error, and using something like
$a=&$x;
return $a;
does not return a reference.
Running 4.0b3 on Apache 1.3.9, compiled with mysql
<?
class tata {
var $a;
}
class toto {
var $a;
function toto() {
$this->a=new tata;
$this->a->a=1;
}
function titi() {
$b=&$this->a;
return $b;
}
}
$x=new toto();
$y=&$x->a;
$z=$x->titi();
$y->a=5;
$z->a=6;
echo "Actual: z->a = $z->a y->a = $y->a x->a->a = ".$x->a->a
."<BR>";
echo "Expected:z->a = 6 y->a = 6 x->a->a = 6 <BR>";
?>