diff options
author | Sebastian Bergmann <sebastian@php.net> | 2005-10-28 20:08:25 +0000 |
---|---|---|
committer | Sebastian Bergmann <sebastian@php.net> | 2005-10-28 20:08:25 +0000 |
commit | 805cc1d6591b4085751ff48a59faa6984aaad32d (patch) | |
tree | d26563252f8bcda5b3ff8977b0d21cfe998e1c69 | |
parent | 82c00c179d3981e1a536025899490410a2ce82bc (diff) | |
download | php-git-805cc1d6591b4085751ff48a59faa6984aaad32d.tar.gz |
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. Patch has been reviewed by Andi, Zeev, and Marcus. I will coordinate with Ilia on merging it to the PHP_5_1 branch after PHP 5.1.0 has been released.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 3 |
2 files changed, 6 insertions, 0 deletions
@@ -22,4 +22,7 @@ PHP NEWS the part of haystack before or after first occurence of needle. (Johannes) - Added possibility to check in which extension an internal function was defined using reflection API. (Johannes) +- 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. (Sebastian) - Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 5967cfc5f2..4027bdc2a2 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -2005,6 +2005,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); add_assoc_text_ex(stack_frame, "class", sizeof("class"), class_name, dup); } + add_assoc_zval_ex(stack_frame, "object", sizeof("object"), ptr->object); + ptr->object->refcount++; + add_assoc_ascii_string_ex(stack_frame, "type", sizeof("type"), "->", 1); } else if (ptr->function_state.function->common.scope) { add_assoc_textl_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, ptr->function_state.function->common.scope->name_length, 1); |