com php-src: Show full stacktraces for exceptions in phpdbg: sapi/phpdbg/phpdbg_prompt.c
| From: | Bob Weinand | Date: | Mon, 20 Apr 2015 12:12:47 +0000 |
| Subject: | com php-src: Show full stacktraces for exceptions in phpdbg: sapi/phpdbg/phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86401@lists.php.net to get a copy of this message | ||
Commit: 61ba269f4c3d2e386484aba025093fd2fc9cdeb1
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 20 Apr 2015 14:12:47 +0200
Parents: 890212866dd2d9842a4c4f97ba385b244651a170
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=61ba269f4c3d2e386484aba025093fd2fc9cdeb1
Log:
Show full stacktraces for exceptions in phpdbg
Changed paths:
M sapi/phpdbg/phpdbg_prompt.c
Diff:
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index aa2b1b8..6dfc8a8 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -555,27 +555,30 @@ static inline void phpdbg_handle_exception(void) /* }}} */
{
zend_fcall_info fci;
zval trace;
+ zend_object *ex = EG(exception);
/* get filename and linenumber before unsetting exception */
const char *filename = zend_get_executed_filename();
uint32_t lineno = zend_get_executed_lineno();
+ EG(exception) = NULL;
+
/* call __toString */
ZVAL_STRINGL(&fci.function_name, "__tostring", sizeof("__tostring") - 1);
fci.size = sizeof(fci);
- fci.function_table = &EG(exception)->ce->function_table;
+ fci.function_table = &ex->ce->function_table;
fci.symbol_table = NULL;
- fci.object = EG(exception);
+ fci.object = ex;
fci.retval = &trace;
fci.param_count = 0;
fci.params = NULL;
fci.no_separation = 1;
if (zend_call_function(&fci, NULL) == SUCCESS) {
- phpdbg_writeln("exception", "name=\"%s\" trace=\"%.*s\"",
"Uncaught %s!\n%.*s", EG(exception)->ce->name->val, Z_STRLEN(trace),
Z_STRVAL(trace));
+ phpdbg_writeln("exception", "name=\"%s\" trace=\"%.*s\"",
"Uncaught %s!\n%.*s", ex->ce->name->val, Z_STRLEN(trace), Z_STRVAL(trace));
zval_ptr_dtor(&trace);
} else {
- phpdbg_error("exception", "name=\"%s\"", "Uncaught %s!",
EG(exception)->ce->name->val);
+ phpdbg_error("exception", "name=\"%s\"", "Uncaught %s!",
ex->ce->name->val);
}
/* output useful information about address */
@@ -587,8 +590,7 @@ static inline void phpdbg_handle_exception(void) /* }}} */
OBJ_RELEASE(EG(prev_exception));
EG(prev_exception) = 0;
}
- OBJ_RELEASE(EG(exception));
- EG(exception) = NULL;
+ OBJ_RELEASE(ex);
EG(opline_before_exception) = NULL;
} /* }}} */