com php-src: Fix breaking on HANDLE_EXCEPTION (opline_b efore_exception): sapi/phpdbg/phpdbg_prompt.c sap i/phpdbg/tests/exceptions_003.phpt

From: Date: Mon, 03 Aug 2015 15:15:40 +0000
Subject: com php-src: Fix breaking on HANDLE_EXCEPTION (opline_b efore_exception): sapi/phpdbg/phpdbg_prompt.c sap i/phpdbg/tests/exceptions_003.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88283@lists.php.net to get a copy of this message
Commit: 34596a3dddb407fc36af7cdf9da55253210da5e1 Author: Bob Weinand <bobwei9@hotmail.com> Mon, 3 Aug 2015 17:15:26 +0200 Parents: 472a8414cc905813f676b48aedb9708f31c6a2dd Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=34596a3dddb407fc36af7cdf9da55253210da5e1 Log: Fix breaking on HANDLE_EXCEPTION (opline_before_exception) Changed paths: M sapi/phpdbg/phpdbg_prompt.c A sapi/phpdbg/tests/exceptions_003.phpt Diff: diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index e920f30..4d9bc00 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -1404,13 +1404,15 @@ void phpdbg_clean(zend_bool full) /* {{{ */ } } /* }}} */ -/* code may behave weirdly if EG(exception) is set */ +/* code may behave weirdly if EG(exception) is set; thus backup it */ #define DO_INTERACTIVE(allow_async_unsafe) do { \ const zend_op *backup_opline; \ + const zend_op *before_ex; \ 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; \ } \ + before_ex = EG(opline_before_exception); \ ++GC_REFCOUNT(exception); \ zend_clear_exception(); \ } \ @@ -1436,6 +1438,7 @@ void phpdbg_clean(zend_bool full) /* {{{ */ Z_OBJ(zv) = exception; \ zend_throw_exception_internal(&zv); \ } \ + EG(opline_before_exception) = before_ex; \ } \ /* fallthrough */ \ default: \ diff --git a/sapi/phpdbg/tests/exceptions_003.phpt b/sapi/phpdbg/tests/exceptions_003.phpt new file mode 100644 index 0000000..fffe7a9 --- /dev/null +++ b/sapi/phpdbg/tests/exceptions_003.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test breaks on HANDLE_EXCEPTION +--PHPDBG-- +b 5 +r +s + +s + + +q +--EXPECTF-- +[Successful compilation of %s] +prompt> [Breakpoint #0 added at %s:5] +prompt> [Breakpoint #0 at %s:5, hits: 1] +>00005: x(); + 00006: } finally { + 00007: print "ok\n"; +prompt> [L0 %s HANDLE_EXCEPTION %s] +>00005: x(); + 00006: } finally { + 00007: print "ok\n"; +prompt> [L7 %s ECHO "ok " %s] +>00007: print "ok\n"; + 00008: } + 00009: } catch (Error $e) { +prompt> ok +[L7 %s FAST_RET<TO_CATCH> ~%d J7 %s] +[L9 %s CATCH "Error" $e 1 %s] +>00005: x(); + 00006: } finally { + 00007: print "ok\n"; +prompt> [L10 %s ECHO "caught " %s] +>00010: print "caught\n"; + 00011: } + 00012: +prompt> caught +[L10 %s RETURN 1 %s] +[Script ended normally] +prompt> +--FILE-- +<?php + +try { + try { + x(); + } finally { + print "ok\n"; + } +} catch (Error $e) { + print "caught\n"; +} + +?>

« previous php.cvs (#88283) next »