diff options
| author | Sebastian Bergmann <sebastian@php.net> | 2005-11-24 05:07:28 +0000 |
|---|---|---|
| committer | Sebastian Bergmann <sebastian@php.net> | 2005-11-24 05:07:28 +0000 |
| commit | f5117c81b39059c83bed8cb387ad9b7a77efe4c4 (patch) | |
| tree | 3234d73b6222ef1ed00090dc5379b720e3e54dfa /Zend/zend_builtin_functions.c | |
| parent | a420b562df557068713a179f40d994f897e3fe4f (diff) | |
| download | php-git-f5117c81b39059c83bed8cb387ad9b7a77efe4c4.tar.gz | |
MFH: Add 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.
Diffstat (limited to 'Zend/zend_builtin_functions.c')
| -rw-r--r-- | Zend/zend_builtin_functions.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 6b0d3d07c6..61caabc5ed 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1813,7 +1813,7 @@ ZEND_FUNCTION(debug_print_backtrace) /* }}} */ -ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRMLS_DC) +ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int provide_object TSRMLS_DC) { zend_execute_data *ptr, *skip; int lineno; @@ -1913,6 +1913,11 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, dup); } + if (provide_object) { + add_assoc_zval_ex(stack_frame, "object", sizeof("object"), ptr->object); + ptr->object->refcount++; + } + add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", 1); } else if (ptr->function_state.function->common.scope) { add_assoc_string_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1); @@ -1994,7 +1999,7 @@ ZEND_FUNCTION(debug_backtrace) ZEND_WRONG_PARAM_COUNT(); } - zend_fetch_debug_backtrace(return_value, 1 TSRMLS_CC); + zend_fetch_debug_backtrace(return_value, 1, 1 TSRMLS_CC); } /* }}} */ |
