summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_prompt.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-07-20 17:52:57 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-07-20 18:00:43 +0200
commit75a3de0cd8b79e2f813eaa663d90bb57edc7a146 (patch)
tree19e14c87eae9057408fccc252b2490d63670f637 /sapi/phpdbg/phpdbg_prompt.c
parent4dc0546a59eb04f32b28f95bab2f02b849217955 (diff)
downloadphp-git-75a3de0cd8b79e2f813eaa663d90bb57edc7a146.tar.gz
Fix misbehaviors with uncaught exceptions and finally or eval
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index a553255b4a..b00952c07b 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -659,6 +659,7 @@ PHPDBG_COMMAND(run) /* {{{ */
char **argv = emalloc(5 * sizeof(char *));
int argc = 0;
int i;
+ /* TODO allow proper escaping with \, "" and '' here */
char *argv_str = strtok(param->str, " ");
while (argv_str) {
@@ -767,15 +768,19 @@ PHPDBG_COMMAND(ev) /* {{{ */
PHPDBG_G(flags) |= PHPDBG_IN_EVAL;
zend_try {
if (zend_eval_stringl(param->str, param->len, &retval, "eval()'d code") == SUCCESS) {
- phpdbg_xml("<eval %r>");
- if (PHPDBG_G(flags) & PHPDBG_WRITE_XML) {
- zval *zvp = &retval;
- phpdbg_xml_var_dump(zvp);
+ if (EG(exception)) {
+ zend_exception_error(EG(exception), E_ERROR);
+ } else {
+ phpdbg_xml("<eval %r>");
+ if (PHPDBG_G(flags) & PHPDBG_WRITE_XML) {
+ zval *zvp = &retval;
+ phpdbg_xml_var_dump(zvp);
+ }
+ zend_print_zval_r(&retval, 0);
+ phpdbg_xml("</eval>");
+ phpdbg_out("\n");
+ zval_ptr_dtor(&retval);
}
- zend_print_zval_r(&retval, 0);
- phpdbg_xml("</eval>");
- phpdbg_out("\n");
- zval_ptr_dtor(&retval);
}
} zend_catch {
EG(current_execute_data) = original_execute_data;
@@ -784,6 +789,7 @@ PHPDBG_COMMAND(ev) /* {{{ */
EG(vm_stack_end) = original_stack->end;
EG(vm_stack) = original_stack;
} zend_end_try();
+
PHPDBG_G(flags) &= ~PHPDBG_IN_EVAL;
/* switch stepping back on */
@@ -1391,18 +1397,17 @@ void phpdbg_clean(zend_bool full) /* {{{ */
\
switch (phpdbg_interactive(allow_async_unsafe)) { \
zval zv; \
- default: \
+ case PHPDBG_LEAVE: \
+ case PHPDBG_FINISH: \
+ case PHPDBG_UNTIL: \
+ case PHPDBG_NEXT: \
if (exception) { \
Z_OBJ(zv) = exception; \
zend_throw_exception_internal(&zv); \
} \
/* fallthrough */ \
- case PHPDBG_LEAVE: \
- case PHPDBG_FINISH: \
- case PHPDBG_UNTIL: \
- case PHPDBG_NEXT:{ \
+ default: \
goto next; \
- } \
} \
} while (0)
@@ -1431,7 +1436,7 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
#endif
/* check for uncaught exceptions */
- if (exception && PHPDBG_G(handled_exception) != exception) {
+ if (exception && PHPDBG_G(handled_exception) != exception && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
zend_execute_data *prev_ex = execute_data;
zval zv, rv;
zend_string *file, *msg;
@@ -1464,16 +1469,14 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
}
ex_is_caught:
- /* allow conditional breakpoints and
- initialization to access the vm uninterrupted */
- if ((PHPDBG_G(flags) & PHPDBG_IN_COND_BP) ||
- (PHPDBG_G(flags) & PHPDBG_IS_INITIALIZING)) {
+ /* allow conditional breakpoints and initialization to access the vm uninterrupted */
+ if (PHPDBG_G(flags) & (PHPDBG_IN_COND_BP | PHPDBG_IS_INITIALIZING)) {
/* skip possible breakpoints */
goto next;
}
/* perform seek operation */
- if (PHPDBG_G(flags) & PHPDBG_SEEK_MASK) {
+ if ((PHPDBG_G(flags) & PHPDBG_SEEK_MASK) && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
/* current address */
zend_ulong address = (zend_ulong) execute_data->opline;