Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27479 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43070 invoked by uid 1010); 16 Jan 2007 09:07:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43055 invoked from network); 16 Jan 2007 09:07:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jan 2007 09:07:05 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 81.169.182.136 cause and error) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from [81.169.182.136] ([81.169.182.136:44891] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/50-36919-8B59CA54 for ; Tue, 16 Jan 2007 04:07:04 -0500 Received: from baumbart.mbo (dslb-084-063-029-203.pools.arcor-ip.net [84.63.29.203]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 3641335C1E0; Tue, 16 Jan 2007 10:07:01 +0100 (CET) Date: Tue, 16 Jan 2007 10:07:06 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <715503765.20070116100706@marcus-boerger.de> To: Derick Rethans Cc: PHP Developers Mailing List In-Reply-To: References: <287851093.20070115233131@marcus-boerger.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Help debugging overloaded objects From: helly@php.net (Marcus Boerger) Hello Derick, I changed the code now to be easier understandable. In the patch the following happens. In the two if cases properties get initialized and in the third case where none of the ifs apply properties will remain NULL. Now in the later code is_temp isonlybeingused if properties is not NULL. Anyway i made the code more readable. best regards marcus Tuesday, January 16, 2007, 12:17:04 AM, you wrote: > 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 Best regards, Marcus