cvs: ZendEngine2(PHP_5_2) / zend_builtin_functions.c /tests bug38047.phpt php-src NEWS

From: Date: Thu, 27 Jul 2006 08:20:38 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_builtin_functions.c /tests bug38047.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5136@lists.php.net to get a copy of this message
dmitry Thu Jul 27 08:20:38 2006 UTC Added files: (Branch: PHP_5_2) /ZendEngine2/tests bug38047.phpt Modified files: /php-src NEWS /ZendEngine2 zend_builtin_functions.c Log: Fixed bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.153&r2=1.2027.2.547.2.154&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.153 php-src/NEWS:1.2027.2.547.2.154 --- php-src/NEWS:1.2027.2.547.2.153 Thu Jul 27 05:17:34 2006 +++ php-src/NEWS Thu Jul 27 08:20:38 2006 @@ -27,6 +27,8 @@ itself). (Ilia) - Fixed bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key names). (Ilia) +- Fixed bug #38047 ("file" and "line" sometimes not set in backtrace from + inside error handler). (Dmitry) - Fixed bug #37564 (AES privacy encryption not possible due to net-snmp 5.2 compatibility issue). (Jani, patch by scott dot moynes+php at gmail dot com) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.277.2.12.2.6&r2=1.277.2.12.2.7&diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.6 ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.7 --- ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.6 Mon Jul 24 17:58:32 2006 +++ ZendEngine2/zend_builtin_functions.c Thu Jul 27 08:20:38 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.6 2006/07/24 17:58:32 helly Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.7 2006/07/27 08:20:38 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -1843,7 +1843,23 @@ if (filename) { zend_printf(") called at [%s:%d]\n", filename, lineno); } else { - ZEND_PUTS(")\n"); + zend_execute_data *prev = skip->prev_execute_data; + + while (prev) { + if (prev->function_state.function && + prev->function_state.function->common.type != ZEND_USER_FUNCTION) { + prev = NULL; + break; + } + if (prev->op_array) { + zend_printf(") called at [%s:%d]\n", prev->op_array->filename, prev->opline->lineno); + break; + } + prev = prev->prev_execute_data; + } + if (!prev) { + ZEND_PUTS(")\n"); + } } include_filename = filename; ptr = skip->prev_execute_data; @@ -1924,7 +1940,7 @@ skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL && skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL_BY_NAME && skip->prev_execute_data->opline->opcode != ZEND_INCLUDE_OR_EVAL) { - skip = skip->prev_execute_data; + skip = skip->prev_execute_data; } if (skip->op_array) { @@ -1937,6 +1953,20 @@ * and debug_baktrace() might have been called by the error_handler. in this case we don't * want to pop anything of the argument-stack */ } else { + zend_execute_data *prev = skip->prev_execute_data; + + while (prev) { + if (prev->function_state.function && + prev->function_state.function->common.type != ZEND_USER_FUNCTION) { + break; + } + if (prev->op_array) { + add_assoc_string_ex(stack_frame, "file", sizeof("file"), prev->op_array->filename, 1); + add_assoc_long_ex(stack_frame, "line", sizeof("line"), prev->opline->lineno); + break; + } + prev = prev->prev_execute_data; + } filename = NULL; } http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug38047.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug38047.phpt +++ ZendEngine2/tests/bug38047.phpt

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