diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-07-28 00:10:08 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-07-28 00:10:42 +0200 |
commit | c0e0f1414e68fd83f3254e59687da7dccbc5bf52 (patch) | |
tree | 90c9fbe956f7fac6331fa28249b39405710394da /sapi/phpdbg/phpdbg_prompt.c | |
parent | 80edd4038397395412e346b53f4e5279a3c39c11 (diff) | |
download | php-git-c0e0f1414e68fd83f3254e59687da7dccbc5bf52.tar.gz |
Fix phpdbg stepping on CATCH with exception
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 9253576f01..89e8d027f6 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -1384,7 +1384,11 @@ void phpdbg_clean(zend_bool full) /* {{{ */ /* code may behave weirdly if EG(exception) is set */ #define DO_INTERACTIVE(allow_async_unsafe) do { \ + const zend_op *backup_opline; \ if (exception) { \ + if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) { \ + backup_opline = EG(current_execute_data)->opline; \ + } \ ++GC_REFCOUNT(exception); \ zend_clear_exception(); \ } \ @@ -1402,8 +1406,14 @@ void phpdbg_clean(zend_bool full) /* {{{ */ case PHPDBG_UNTIL: \ case PHPDBG_NEXT: \ if (exception) { \ - Z_OBJ(zv) = exception; \ - zend_throw_exception_internal(&zv); \ + if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type) \ + && (backup_opline->opcode == ZEND_HANDLE_EXCEPTION || backup_opline->opcode == ZEND_CATCH)) { \ + EG(current_execute_data)->opline = backup_opline; \ + EG(exception) = exception; \ + } else { \ + Z_OBJ(zv) = exception; \ + zend_throw_exception_internal(&zv); \ + } \ } \ /* fallthrough */ \ default: \ |