ID: 40477 User updated by: piotrek dot pokora at gmail dot com -Summary: object's read property handler not used in zend_print_zval_r_ex Reported By: piotrek dot pokora at gmail dot com -Status: Bogus +Status: Open Bug Type: Variables related Operating System: debian/linux PHP Version: 5.2.1 New Comment:
> Again, please use pecl-dev, this is not a forum. http://pecl.php.net/bugs/ points directly to bugs.php.net. So I think I am at correct bugtracker. Previous Comments: ------------------------------------------------------------------------ [2007-02-14 15:56:19] [EMAIL PROTECTED] Again, please use pecl-dev, this is not a forum. ------------------------------------------------------------------------ [2007-02-14 15:51:49] piotrek dot pokora at gmail dot com >Please use pecl-dev. Please, make this bug open for the sake of logic and consistency. I know how to write own get_properties hook. I know how to workaround this problem ( yes it's workaround now, ugly though ). I know what any php extension developer is able to tell me. It doesn't change the fact that print_r or var_dump doesn't respect object's read_property hook. It must be clear and clean that (pseudocode): if(zval.type == IS_OBJECT) zval.value.obj.handlers.read_property Will pecl-dev advice will fix this issue? No. Is there another zend bug tracker and pecl-dev will help me find it? Or should I prepare patch and send somewhere? ------------------------------------------------------------------------ [2007-02-14 15:33:25] [EMAIL PROTECTED] Please use pecl-dev. ------------------------------------------------------------------------ [2007-02-14 15:31:25] piotrek dot pokora at gmail dot com >>Look at mysqli implementation. >>It DOES NOT contain get_properties hook and works. Why? >var_dump($mysqli_object); >Do you see anything? No. >That's why. Is it difficult to add posibility to read object's property from its own read_property hook? This bug is just about this. The point here is: even I add own get_properties function I can not update them in object's hash properties scope. At least it is not done via standard write_property handler. So I need to use own or standard hooks + additional object's properties hash table update which duplicates operation. Of course , get_properties hook can be missed in favour of own properties registration. But coming back to mysqli example: part of object constructor: zend_object_std_init(&intern->zo, class_type TSRMLS_CC); zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); The same hash is used by print_r, and doesn't have to be used in read or write property hook to make those hooks work. And coming back to this bug summary: All I report here is the issue of print_r and var_dump which uses zval.value.obj.properties hash table which doesn't have to be used in read or write property hooks. My hook doesn't require hash table value updates, all I need is object's property name ( hash key in this case ). print_r and var_dump uses hash table ( only ) so I need to update keys' values to make these function work. Why I defined my own hooks? Because print_r or var_dump or any other OOP featire in ZEND&PHP should respect my hooks. Right? If ZEND requires object's properties hash table value updates then I do not need read property hook as I can get property value from hash table. If ZEND requires updated hash table ( with keys and values ) in function like print_r , how can I avoid setting the same value twice? Once in write hook and once as hash value? I can add own get_properties hook. But print_r and var_dump will print values of properties only ( and only ) when I update hash table which is not mandatory in read or write property hook. ------------------------------------------------------------------------ [2007-02-14 15:00:22] [EMAIL PROTECTED] >As it works without get_properties. Oh, yes it does work, but you can't get the list of properties without implementing get_properties(). >It's enough to add own read and write property hook No, it's obviously not enough. See below why. >Look at mysqli implementation. >It DOES NOT contain get_properties hook and works. Why? var_dump($mysqli_object); Do you see anything? No. That's why. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/40477 -- Edit this bug report at http://bugs.php.net/?id=40477&edit=1