cvs: ZendEngine2 / zend_builtin_functions.c

From: Date: Mon, 02 Sep 2002 12:20:09 +0000
Subject: cvs: ZendEngine2 / zend_builtin_functions.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-381@lists.php.net to get a copy of this message
thies Mon Sep 2 08:20:09 2002 EDT Modified files: /ZendEngine2 zend_builtin_functions.c Log: debug_backtrace() now checks the complete argument-stack for consistency. Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.141 ZendEngine2/zend_builtin_functions.c:1.142 --- ZendEngine2/zend_builtin_functions.c:1.141 Wed Aug 28 11:05:15 2002 +++ ZendEngine2/zend_builtin_functions.c Mon Sep 2 08:20:09 2002 @@ -1280,20 +1280,34 @@ char *include_filename = NULL; zval *stack_frame; void **cur_arg_pos = EG(argument_stack).top_element; + void **args = cur_arg_pos; + int arg_stack_consitent = 0; if (ZEND_NUM_ARGS()) { WRONG_PARAM_COUNT; } + while (--args >= EG(argument_stack).elements) { + if (*args--) { + break; + } + args -= *(ulong*)args; + + if (args == EG(argument_stack).elements) { + arg_stack_consitent = 1; + break; + } + } + + if (! arg_stack_consitent) { + zend_error(E_ERROR, "debug_backtrace(): Can't be called by function parameter"); + } + ptr = EG(current_execute_data); /* skip debug_backtrace() */ ptr = ptr->prev_execute_data; cur_arg_pos -= 2; - - if (ptr && cur_arg_pos[-1]) { - zend_error(E_ERROR, "debug_backtrace(): Can't be used as a function parameter"); - } array_init(return_value);

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