Re: print_r unaware of object's read_property handler
| From: | Antony Dovgal | Date: | Thu, 15 Feb 2007 14:30:35 +0000 |
| Subject: | Re: print_r unaware of object's read_property handler | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4531@lists.php.net to get a copy of this message | ||
On 02/15/2007 05:13 PM, Piotr Pokora wrote:
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?Great. And I can assure that read_property() IS used. Always. But there are cases when we can't use it. And in such cases get_properties() is used instead. I've already explained why it's used and how it works. Do I need to repeat myself again?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 expected you to listen to me. But you obviously refuse to do it. Expectations might be wrong. Too bad.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.
Well, you were wrong. Again, get_properties() returns both names and values, so there is no need to call read_property(). *No need*, okay? You do have all the values already.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.
"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?Please, wake up. print_r() prints each property only once.
Or do you mean read_property implementation which internally uses get_properties?No, I mean quite the contrary - get_properties() implementation using read_properties() OR (and this would seem more correct to me) using the same utilities to create properties hash. -- Wbr, Antony Dovgal