Re: print_r unaware of object's read_property handler
| From: | Antony Dovgal | Date: | Fri, 16 Feb 2007 06:42:53 +0000 |
| Subject: | Re: print_r unaware of object's read_property handler | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4545@lists.php.net to get a copy of this message | ||
On 02/16/2007 01:50 AM, Piotr Pokora wrote:
You are contradicting yourself, don't you see?On 02/16/2007 12:05 AM, Piotr Pokora wrote:As great as this song "you can do it your own way , if it's done just how I say" ;)How can I say...? One framework has clear rules for objects and properties and another one has not :)Which means you're not bound to any rules and free to do anything you like. Isn't it great? Isn't it C?
Three different examples doing almost the same: php_sw_handle_get_properties() php_sw_result_get_properties() php_sw_results_get_properties()1. Set object's properties in constructor. Bad for derived classes which use own constructor. 2. Update ce.default_properties hash when class is registered. Is it safe? ZEND1 segfaulted with such implementation.Why don't you look into http://cvs.php.net/pecl/swish/swish.c and find an example demonstrating how this stuff works?Well, I can not find any suitable part of the code either in object's constructor or when class is registered. That's why I asked.
The simplest solution seems to be update default_properties of class pointer returned by zend_register_internal_class. It should work for derived classes too, right?I believe the simplest solution would be to use the recommended solution instead of inventing the wheel and developing odd theories, including OO ones. You're trying to do something really weird, no wonder you have problems with its implementation. -- Wbr, Antony Dovgal