cvs: Zend / zend_builtin_functions.c

From: Date: Mon, 21 Oct 2002 08:42:32 +0000
Subject: cvs: Zend / zend_builtin_functions.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-525@lists.php.net to get a copy of this message
thies Mon Oct 21 04:42:32 2002 EDT Modified files: /Zend zend_builtin_functions.c Log: debug_backtrace(): make sure we don't take too many arguments off the argument-stack. Index: Zend/zend_builtin_functions.c diff -u Zend/zend_builtin_functions.c:1.123 Zend/zend_builtin_functions.c:1.124 --- Zend/zend_builtin_functions.c:1.123 Wed Oct 9 10:17:53 2002 +++ Zend/zend_builtin_functions.c Mon Oct 21 04:42:32 2002 @@ -1183,6 +1183,7 @@ void **cur_arg_pos = EG(argument_stack).top_element; void **args = cur_arg_pos; int arg_stack_consistent = 0; + int frames_on_stack = 0; if (ZEND_NUM_ARGS()) { WRONG_PARAM_COUNT; @@ -1193,6 +1194,7 @@ break; } args -= *(ulong*)args; + frames_on_stack++; if (args == EG(argument_stack).elements) { arg_stack_consistent = 1; @@ -1205,6 +1207,7 @@ /* skip debug_backtrace() */ ptr = ptr->prev_execute_data; cur_arg_pos -= 2; + frames_on_stack--; array_init(return_value); @@ -1247,8 +1250,9 @@ } if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) { - if (arg_stack_consistent) { + if (arg_stack_consistent && (frames_on_stack > 0)) { add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC)); + frames_on_stack--; } } } else {

« previous php.zend-engine.cvs (#525) next »