Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4984 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33866 invoked by uid 1010); 25 Oct 2003 13:07:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33832 invoked from network); 25 Oct 2003 13:07:48 -0000 Received: from unknown (HELO matrix.gna.ch) (195.226.6.8) by pb1.pair.com with SMTP; 25 Oct 2003 13:07:48 -0000 Received: from localhost (localhost [127.0.0.1]) by matrix.gna.ch (Postfix) with ESMTP id 6835A14C for ; Sat, 25 Oct 2003 15:07:47 +0200 (CEST) Received: by matrix.gna.ch (Postfix, from userid 65534) id 1CCD015A; Sat, 25 Oct 2003 15:07:46 +0200 (CEST) Received: from cschneid.com (unknown [195.226.4.61]) by matrix.gna.ch (Postfix) with ESMTP id 257C914C for ; Sat, 25 Oct 2003 15:07:44 +0200 (CEST) Message-ID: <3F9A759F.5070402@cschneid.com> Date: Sat, 25 Oct 2003 15:07:43 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031009 X-Accept-Language: de-ch, en-us, en MIME-Version: 1.0 To: PHP internals X-Enigmail-Version: 0.76.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------080700030605080502080701" X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on matrix.gna.ch X-Spam-Level: X-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.60 X-Virus-Scanned: by AMaViS Ultramail snapshot-20020531 Subject: Adding vars to debug_backtrace() From: cschneid@cschneid.com (Christian Schneider) --------------080700030605080502080701 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hey folks, I'd like to add the local variables for all stack-frames to the result of debug_backtrace(), i.e. each array entry contains a 'vars' field pointing to the symbol table of that frame. A patch for PHP4/Zend is attached. Opinions? - Chris --------------080700030605080502080701 Content-Type: text/plain; name="vars_debug_backtrace.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vars_debug_backtrace.patch" Index: Zend/zend_builtin_functions.c =================================================================== RCS file: /repository/Zend/Attic/zend_builtin_functions.c,v retrieving revision 1.124.2.9 diff -u -a -r1.124.2.9 zend_builtin_functions.c --- Zend/zend_builtin_functions.c 16 Jun 2003 15:55:07 -0000 1.124.2.9 +++ Zend/zend_builtin_functions.c 25 Oct 2003 13:05:42 -0000 @@ -1234,6 +1234,17 @@ filename = NULL; } + if (ptr->function_state.function_symbol_table) { + zval *vars; + ALLOC_INIT_ZVAL(vars); + vars->value.ht = ptr->function_state.function_symbol_table; + vars->type = IS_ARRAY; + vars->is_ref = 1; + vars->refcount = 2; /* we don't want this one to be freed */ + add_assoc_zval_ex(stack_frame, "vars", sizeof("vars"), vars); + FREE_ZVAL(vars); + } + function_name = ptr->function_state.function->type != ZEND_OVERLOADED_FUNCTION ? ptr->function_state.function->common.function_name : get_active_function_name(TSRMLS_C); /* "OVERLOADED_FUNCTION" */ if (function_name) { --------------080700030605080502080701--