Re: $obj = new foo() patch

From: Date: Sat, 11 Nov 2000 22:27:47 +0000
Subject: Re: $obj = new foo() patch
References: 1 2 3 4  Groups: php.dev 
Request: Send a blank email to php-dev+get-37780@lists.php.net to get a copy of this message
At 14:07 10/11/2000, André Langhorst wrote:
PHP 4.0.4 will be the first version of PHP that does not allow you to send anything by reference unless it is a variable (as opposed to a function call return value, for instance).
this does not work anymore! is this supposed not to work anymore regardless of what a method returns? $foo->foo($foo2->foo());
Right (yes, it's not supposed to work, and actually, was never supposed to work).
if so it should be documented, it is unexpected behaviour and I don´t understand it at all, don´t you agree that only moving... $foo->foo($foo2->foo()); to... $foo_tmp=&$foo2->foo(); $foo->foo($foo_tmp); is a step backwards in language? if it´s not intended, it´s a bug again...
It's not a bug, it's quite intended. As I said numerous times in the last few days, the fact it didn't explicitly error out doesn't mean it actually work. It worked under some conditions, but could cause a serious memory corruption under other conditions. BTW, you can take a look and see the inherent difference between the two notations - in the first, we don't know at compile-time that $foo2->foo() is going to return a reference. In the 2nd, we do. At any rate, from Andi's and my point of view, we want to delay 4.0.4 until we resolve all the OO and reference issues that are currently pending to a reasonable degree. We've just been a bit time stressed in the last few days, but we'd hopefully get around to seeing what can be done this week. Zeev -- Zeev Suraski <zeev@zend.com> CTO, Zend Technologies Ltd. http://www.zend.com/

« previous php.dev (#37780) next »