Re: print_r unaware of object's read_property handler
| From: | Piotr Pokora | Date: | Thu, 15 Feb 2007 14:13:47 +0000 |
| Subject: | Re: print_r unaware of object's read_property handler | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4529@lists.php.net to get a copy of this message | ||
antony@zend.com (Antony Dovgal) wrote:
> > If one of my hooks updates object's properties ( both keys and values ) ,
> > is this kind of overloading if I return zval using read_property and zval is not
> > returned from object's properties?
>
> > In such scenario , every OOP code works , except print_r.
>
> Could you finally tell us what exactly is wrong there, so we can switch to the real problem
> instead of wasting your and our time on a non-existent one?
Real problem is:
I expect , every single part of ZEND engine uses my read_property hook.
Every.
> > You mean hash_find VS get_properties and read_properties ?
>
> I mean get_properties() VS get_properties() + read_properties()*number_of_properties.
So what? I pass object type as print_r argument so I expect object's hook is used there.
Not print zval returned from hash.
This is performance vs consistency problem.
> >> Which part of the sentence makes you think so?
> >
> > "Because get_properties() returns both names and values of the properties"
>
> Do you understand that get_properties(), read_property() and write_property() do completely
> different things and called in different cases?
Yes, and I understand that I defined read_property hook which should be used for property's
value reading.
Yes.
"I mean get_properties() VS get_properties() + read_properties()*number_of_properties."
Does it mean that you do print zval once? Not print zval * number_of_properties?
Or do you mean read_property implementation which internally uses get_properties?
Piotras