Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31774 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78512 invoked by uid 1010); 21 Aug 2007 06:36:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 78497 invoked from network); 21 Aug 2007 06:36:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2007 06:36:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=php-php-dev@m.gmane.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=news@sea.gmane.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain m.gmane.org designates 80.91.229.2 as permitted sender) X-PHP-List-Original-Sender: php-php-dev@m.gmane.org X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.5 (sometimes 2.4) (4) Received: from [80.91.229.2] ([80.91.229.2:47910] helo=ciao.gmane.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/15-36574-5F78AC64 for ; Tue, 21 Aug 2007 02:36:37 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1INNLt-0005VG-JV for internals@lists.php.net; Tue, 21 Aug 2007 08:36:33 +0200 Received: from p5088d4be.dip.t-dialin.net ([80.136.212.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Aug 2007 08:36:33 +0200 Received: from sb by p5088d4be.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Aug 2007 08:36:33 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Tue, 21 Aug 2007 08:36:27 +0200 Lines: 49 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: p5088d4be.dip.t-dialin.net User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Sender: news Subject: [PATCH] Add optional parameter $provide_object to debug_backtrace() From: sb@sebastian-bergmann.de (Sebastian Bergmann) For PHP 5.1.1, I added an additional field $frame['object'] to the result array of debug_backtrace() that contains a reference to the respective object when the frame was called from an object. What I did not think of at the time, unfortunately, is the fact that unconditionally including $frame['object'] in the result array can get in the way of using print_r(debug_backtrace()), for instance, for debugging purposes. With the patch below, I propose the addition of an optional parameter $provide_object to debug_backtrace() that toggles the inclusion of $frame['object'] in the result array. The value of $provide_object defaults to 1 so as not to break BC. Index: zend_builtin_functions.c =================================================================== RCS file: /repository/ZendEngine2/zend_builtin_functions.c,v retrieving revision 1.277.2.12.2.23 diff -u -B -r1.277.2.12.2.23 zend_builtin_functions.c --- zend_builtin_functions.c 8 Aug 2007 13:32:46 -0000 1.277.2.12.2.23 +++ zend_builtin_functions.c 21 Aug 2007 06:31:32 -0000 @@ -2093,15 +2093,17 @@ /* }}} */ -/* {{{ proto array debug_backtrace(void) +/* {{{ proto array debug_backtrace([bool provide_object]) Return backtrace as array */ ZEND_FUNCTION(debug_backtrace) { - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + zend_bool provide_object = 1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &provide_object) == FAILURE) { + return; } - zend_fetch_debug_backtrace(return_value, 1, 1 TSRMLS_CC); + zend_fetch_debug_backtrace(return_value, 1, provide_object TSRMLS_CC); } /* }}} */ -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69