Hello Rob,
Tuesday, July 6, 2004, 12:15:31 PM, you wrote:
> I was playing around with Bug #28817 and seem to have run into an issue
> when overriding the read_property handler with an extended object (this
> case a DomDocument object).
> In order to support standard properties correctly, such as
> $obj->myprop['a'] = 'b', the internal object needs to support
> get_property_ptr_ptr. As the internal object here overrides the
> read_property handler, it would also need to override the
> get_property_ptr_ptr handler to make that standard property work
> correctly, which is where I have run into some problems.
> At first, I implemented a get_property_ptr_ptr handler, but found that
> for the base internal class properties, this method needs to return NULL
> so that cases like zend_pre_incdec_property would fall back to the
> read_property/write_property handling. Next was to return NULL for all
> properties of the base internal class and return the result of the
> standard get_property_ptr_ptr for non base class properties. This fixed
> the standard properties, but returning NULL for the internal base
> properties breaks calls like:
> $document->documentElement->ownerDocument;
> because zend_fetch_property_address_inner will not fall back to the
> read_property handler if NULL is returned get_property_ptr_ptr.
> Rather the error "Cannot access undefined property for object with
> overloaded property access" is returned.
> Is this is a pitfall of the engine or is there something I am
> overlooking which would allow this to work across all cases?
Sounds more like small oversight. Could you try to make a patch for that?
Best regards,
Marcus mailto:helly@php.net