[patch] Zend/zend_object_handlers.c - bug #29378 (foreach() doesn't work with arrays returned by __get)
| From: | Antony Dovgal | Date: | Fri, 10 Sep 2004 05:57:27 +0000 |
| Subject: | [patch] Zend/zend_object_handlers.c - bug #29378 (foreach() doesn't work with arrays returned by __get) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-12698@lists.php.net to get a copy of this message | ||
Another one patch for ZE.
This one fixes the bug #29378.
It looks like this bug was done intentionally (I'm not sure, just an
assumption), so zend_std_get_property_ptr_ptr() doesn't call __get.
Please look at the patch fro details.
--
Wbr,
Antony Dovgal aka tony2001
tony2001@phpclub.net || antony@dovgal.com
Index: zend_object_handlers.c =================================================================== RCS file: /repository/ZendEngine2/zend_object_handlers.c,v retrieving revision 1.104 diff -u -r1.104 zend_object_handlers.c --- zend_object_handlers.c 22 Jul 2004 11:54:27 -0000 1.104 +++ zend_object_handlers.c 6 Sep 2004 05:28:17 -0000 @@ -474,8 +474,11 @@ new_zval->refcount++; zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval); } else { - /* we do have getter - fail and let it try again with usual get/set */ - retval = NULL; + zval *getter_retval = zend_std_call_getter(object, member TSRMLS_CC); + if (!getter_retval) { + getter_retval = &EG(uninitialized_zval); + } + retval = &getter_retval; } } if (member == &tmp_member) {
Index: zend_object_handlers.c =================================================================== RCS file: /repository/ZendEngine2/zend_object_handlers.c,v retrieving revision 1.104 diff -u -r1.104 zend_object_handlers.c --- zend_object_handlers.c 22 Jul 2004 11:54:27 -0000 1.104 +++ zend_object_handlers.c 6 Sep 2004 05:28:17 -0000 @@ -474,8 +474,11 @@ new_zval->refcount++; zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval); } else { - /* we do have getter - fail and let it try again with usual get/set */ - retval = NULL; + zval *getter_retval = zend_std_call_getter(object, member TSRMLS_CC); + if (!getter_retval) { + getter_retval = &EG(uninitialized_zval); + } + retval = &getter_retval; } } if (member == &tmp_member) {