Re: print_r unaware of object's read_property handler

From: Date: Thu, 15 Feb 2007 12:57:39 +0000
Subject: Re: print_r unaware of object's read_property handler
References: 1 2 3 4 5 6  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-4519@lists.php.net to get a copy of this message
mike@php.net (Michael Wallner) wrote: > Piotr Pokora wrote: > [snip] > > Why don't you just implement a get_properties() handler where you > use your read_property() implementation then? Because get_properties hook which updates only keys in object's properties hash won't resolve the problem if your read_property hook doesn't return hash value. Point here is that I use underlying GObject object so read_property returns zval created from GValue, and object's properties hash has only keys wihout values assigned to them. Basic concept is: 1. "Register" object's properties in constructor ( using add_property_xxxx ) 2. Use standard get_properties handler which returns hash updated in constructor 3. Use write and read property hooks to set GObject's Gvalue from zval or return zval from GValue. This approach works pretty fine for OOP , but fails with print_r which expects fully updated hash properties. Probably my approach is bad , but I found similiar solution in mysqli extension. Piotras

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