Re: print_r unaware of object's read_property handler

From: Date: Fri, 16 Feb 2007 15:24:14 +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 20  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-4562@lists.php.net to get a copy of this message
mike@php.net (Michael Wallner) wrote: > > It clearly shows that get_property hook is invoked when user needs to read property with > > $obj->property code. > > How I shouldn't worry about performance here? > > Are you sure you don't have an equivalent php_error("GET PROP") call in your > get_property() handler? OK I found it. It's caused by 'zend_hash_find(Z_OBJPROP_P((zval*)' which "obviously" invokes get_properties. And it is placed in my read_property hook. Thank you *all* for your patience! It would be good to mention about get_properties usage in OBJECTS2_HOWTO. http://cvs.php.net/viewvc.cgi/ZendEngine2/OBJECTS2_HOWTO?revision=1.6&view=markup There's no single word about it there. get_properties - called when object's properties HashTable should be fetched for reading. Unlike ZEND1 engine, ZEND2 does not directly read object's properties table. But instead get_properties handler is invoked. The most common usage is: * debugging with functions like print_r or var_dump * looking for a property of an object If custom extension implements own hook, it's recommended to return object's properties with all values assigned to properties. ...something like that :) Piotras

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