Problem with pass-by-ref
| From: | Andi Gutmans | Date: | Sun, 19 Nov 2000 20:00:33 +0000 |
| Subject: | Problem with pass-by-ref | ||
| Groups: | php.dev php.qa | ||
| Request: | Send a blank email to php-dev+get-38515@lists.php.net to get a copy of this message | ||
Guys,
I just commited a patch which might solve the problem of many with the patch Zeev and I recently introduced which disallows passing non-variables by reference. (Update the Zend CVS).
This fix will allow you to do so now ONLY if the function argument is really a reference.
For example:
function bar(&$blah)
{
print "Hey";
}
function &foo()
{
$obj = new foobar()
return $obj;
}
bar(foo()); // This will work now.
bar(new foobar()); // Should work.
bar(5); // Won't work
bar($a = 5) // Won't work.
Please check if your code which broke due to our previous patch with a
"Only variables can be passed by reference" is OK now (unless your code was really broken :)
Hopefully I'll have a patch for the $obj = new foo() problem when $this is assigned by reference within the constructor tomorrow.
Andi
---
Andi Gutmans <andi@zend.com>
http://www.zend.com/