Justtechjobs.com Find a programming school near you






Online Campus Both


php-developer-list | 2000111

Re: [PHP-DEV] $obj = new foo() patch From: Zeev Suraski (zeev <email protected>)
Date: 11/11/00

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 <email protected>>
CTO, Zend Technologies Ltd.  http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>