summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>2002-08-23 14:44:58 +0000
committerThies C. Arntzen <thies@php.net>2002-08-23 14:44:58 +0000
commiteea1a0b29667129d3d6e6a5b4253b9cb022d9baf (patch)
treebe037e6ad4d3fbedfd88326d902be26d17f99155 /Zend/zend_builtin_functions.c
parent8feda5cb6adf209d24e8d4e57a3d7ba268c1a766 (diff)
downloadphp-git-eea1a0b29667129d3d6e6a5b4253b9cb022d9baf.tar.gz
debug_backtrace: show include/require/eval as normal functions on the stack
# the hard bit is to find out the args for those
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 44545ddad8..46168f7799 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1301,7 +1301,6 @@ ZEND_FUNCTION(debug_backtrace)
class_name = ptr->function_state.function->common.scope->name;
add_assoc_string_ex(stack_frame, "type", sizeof("type"), "::", 1);
}
- function_name = ptr->function_state.function->common.function_name;
if (ptr->op_array) {
filename = ptr->op_array->filename;
@@ -1310,15 +1309,30 @@ ZEND_FUNCTION(debug_backtrace)
add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
}
+ function_name = ptr->function_state.function->common.function_name;
+
if (function_name) {
add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
- }
- if (class_name) {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1);
- }
+ if (class_name) {
+ add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1);
+ }
+
+ add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos, 0 TSRMLS_CC));
+ } else {
+ /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
+
+ switch (ptr->opline->op2.u.constant.value.lval) {
+ case ZEND_EVAL: function_name = "eval"; break;
+ case ZEND_INCLUDE: function_name = "include"; break;
+ case ZEND_REQUIRE: function_name = "require"; break;
+ case ZEND_INCLUDE_ONCE: function_name = "include_once"; break;
+ case ZEND_REQUIRE_ONCE: function_name = "require_once"; break;
+ default: function_name = "unknown - please report a bug"; break;
+ }
- add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos, 0 TSRMLS_CC));
+ add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
+ }
add_next_index_zval(return_value, stack_frame);