logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: print_r unaware of object's read_property handler: msg#00046

Subject: Re: print_r unaware of object's read_property handler
mike@xxxxxxx (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



<Prev in Thread] Current Thread [Next in Thread>