diff options
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index aa2b1b8b0f..6dfc8a8c80 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; } /* }}} */ |