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
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) {-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
