Re: print_r unaware of object's read_property handler

From: Date: Fri, 16 Feb 2007 10:12:17 +0000
Subject: Re: print_r unaware of object's read_property handler
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-4550@lists.php.net to get a copy of this message
Hi Piotr, On 2/16/07, Piotr Pokora <piotrek.pokora@gmail.com> wrote:
antony@zend.com (Antony Dovgal) wrote:
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. No, Antony. I do not try to do something weird. I expect you are familiar with GObject basic functionality, and your suggestion will kill performance and provide anything but code reuse.
GObject is one project and does not dictate how to deal with pseudo OO in C to any other applications. I'm not saying it is bad or good only stating a fact. You cannot expect anyone here to be familiar with GObject (or midgard for that matter). I use GObject in some of my private extensions (check php-GTK for public code, it certainly has some gobject usages as well), it works for extended classes, print_r, var_dump, etc. But you have to implement almost all handlers. It is slower than a PHP only property (no handler, only the hash table), but there is no other solution. You can minimize the performance impact by tweaking your implementation (see other extensions for examples, gobject is not the only case where something like that is needed).
I just wrote simple test. it looks like this (briefly):
Why don't you put a really simple, complete and working test online so we have a common base to discuss? Including the userland code to show what you try to achieve. I try to understand what's your problem but you seem to completely ignore Tony's valuable comments and advices. Maybe having a source (a really simple source which only works with one basic GObject + two props) will help a lot, codes are sometimes better than long and cryptic explanations. --Pierre

« previous php.pecl.dev (#4550) next »