From: Zeev Suraski

> The correct solution, I think, would be adding a boolean function (or even
> just a bit) to the handlers structure, that instructs the engine whether
it
> should use get_ptr_ptr for incdec or not, since it's an
> optimization.  Maybe we can just check whether we're dealing with PHP
> objects and perform this optimization only then.  I need to look into it.

I dont see the problem as being with incdec. In my particular case at least,
I dont want to implement get_ptr_ptr. The only reason it was needed was to
support properties on an extended object which are not from the base class.
All the properties of the base class want/need to be handled with the
read/write_property handlers. If a property is not of the base class, then
get_ptr_ptr is needed so that the standard get_ptr_ptr handler can be called
for those properties, while all base class properties would return NULL from
the get_ptr_ptr handler (thus in most cases defaulting to calling the
read_property handler).

zend_fetch_property_address_inner is the only function that does not fall
back on the read_property if NULL is returned from get_ptr_ptr. Looking at
the other bug mentioned (28444), standard objects also fall into a similar
problem I hit when returning NULL from get_ptr_ptr.
zend_std_get_property_ptr_ptr assumes that if it returns NULL, then it
should try with the normal __get handler (which also errors out since
zend_fetch_property_address_inner doesnt fall back to the other handler).

If there is a problem with always forcing zend_fetch_property_address_inner
to use the read_property handler when get_ptr_ptr returns NULL, it should at
least allow it to fall back to the read_property handler when the object is
not a standard object. In this case the developer knows they are returning
NULL or a zval ** for a reason and are handling things in the read_property
handler if needed, though it still leaves open the issue with standard
objects.

Rob

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to