Re: PHP 5.2-dev "Cannot use array returned from foo::__get('bar') in write context"
| From: | Marcus Boerger | Date: | Thu, 20 Jul 2006 07:35:54 +0000 |
| Subject: | Re: PHP 5.2-dev "Cannot use array returned from foo::__get('bar') in write context" | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24740@lists.php.net to get a copy of this message | ||
Hello Andi,
the question was how to implement this as a c ref is a pointer, in case
of zval*'s it is a zval** but in php a ref is a zval with is_ref=1. If
we go with php refs then we would convert all variables to refs. Now i
wonder if we could chang the return type to be a c reference only, can
we do that? And is it even wanted? Since if it were easily possible, why
aren't we doing that everywhere? It would solve a bunch of issues...
best regards
marcus
Thursday, July 20, 2006, 7:40:37 AM, you wrote:
> We were considering supporting a __getRef() method. You could implement
> either or both of them and then the right thing would happen.
> Dmitry, Marcus - Besides having to come to a decision about this, is there
> any situation you guys discussed for which this would not work?
> Thx.
> Andi
>> -----Original Message-----
>> From: Dmitry Stogov [mailto:dmitry@zend.com]
>> Sent: Wednesday, July 19, 2006 8:23 AM
>> To: internals@lists.php.net
>> Cc: Marcus Boerger; Andi Gutmans
>> Subject: RE: [PHP-DEV] PHP 5.2-dev "Cannot use array returned
>> from foo::__get('bar') in write context"
>>
>> __get() never worked in write context proper.
>> It just CAN NOT work proper, because __get() returns by value
>> (zval*), but modification requires address (zval**).
>> We have a lot of __get() related bugs because of this
>> situation in bugs.php.net.
>>
>> Month ago Marcus disabled usage of __get() in write context
>> and I am completely agree with him We cannot use E_STRICT for
>> this error and then SIGSEGV.
>>
>> Thanks. Dmitry.
>>
>>
>>
>>
>>
Best regards,
Marcus