Re: [RFC] Help debugging overloaded objects
| From: | Derick Rethans | Date: | Mon, 15 Jan 2007 23:17:04 +0000 |
| Subject: | Re: [RFC] Help debugging overloaded objects | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-27474@lists.php.net to get a copy of this message | ||
On Mon, 15 Jan 2007, Marcus Boerger wrote:
> Any comments?
Shouldn't you init is_temp here? As far as I can see it is not initialized in
every code path, and there is an if() using it in the 3rd patch element here:
> @@ -581,6 +581,7 @@ ZEND_API void zend_print_zval_r_ex(zend_
> HashTable *properties = NULL;
> zstr class_name = NULL_ZSTR;
> zend_uint clen;
> + int is_temp;
>
>
> if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
> Z_OBJ_HANDLER_P(expr, get_class_name)(expr,
> &class_name, &clen, 0 TSRMLS_CC);
> @@ -593,8 +594,11 @@ ZEND_API void zend_print_zval_r_ex(zend_
> if (class_name.v) {
> efree(class_name.v);
> }
> - if (Z_OBJ_HANDLER_P(expr, get_properties)) {
> + if (Z_OBJ_HANDLER_P(expr, get_debug_info)) {
> + properties = Z_OBJ_HANDLER_P(expr,
> get_debug_info)(expr, &is_temp TSRMLS_CC);
> + } else if (Z_OBJ_HANDLER_P(expr, get_properties)) {
> properties = Z_OBJPROP_P(expr);
> + is_temp = 0;
> }
> if (properties) {
> if (++properties->nApplyCount>1) {
> @@ -604,6 +608,10 @@ ZEND_API void zend_print_zval_r_ex(zend_
> }
> print_hash(properties, indent, 1 TSRMLS_CC);
> properties->nApplyCount--;
> + if (is_temp) {
> + zend_hash_destroy(properties);
> + efree(properties);
> + }
> }
> break;
> }
regards,
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org