From: Dmitry Stogov Date: Thu, 24 Nov 2005 11:32:44 +0000 (+0000) Subject: Fixed bug #35360 (exceptions in interactive mode (php -a) may cause crash) X-Git-Tag: RELEASE_2_0_2~101 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a42086c73cd1fce4abb835a14e68ce9c7fb2e000;p=php Fixed bug #35360 (exceptions in interactive mode (php -a) may cause crash) --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 44f91c3426..4575392c79 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1827,12 +1827,14 @@ void zend_do_mark_last_catch(znode *first_catch, znode *last_additional_catch TS } else { CG(active_op_array)->opcodes[last_additional_catch->u.opline_num].op1.u.EA.type = 1; } + DEC_BPC(CG(active_op_array)); } void zend_do_try(znode *try_token TSRMLS_DC) { try_token->u.opline_num = zend_add_try_element(get_next_op_number(CG(active_op_array)) TSRMLS_CC); + INC_BPC(CG(active_op_array)); } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index c2f60bf969..25e828c44e 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1217,6 +1217,8 @@ void execute_new_code(TSRMLS_D) INIT_ZVAL(ret_opline->op1.u.constant); SET_UNUSED(ret_opline->op2); + zend_do_handle_exception(TSRMLS_C); + if (!CG(active_op_array)->start_op) { CG(active_op_array)->start_op = CG(active_op_array)->opcodes; } @@ -1254,8 +1256,12 @@ void execute_new_code(TSRMLS_D) if (local_retval) { zval_ptr_dtor(&local_retval); } + + if (EG(exception)) { + zend_exception_error(EG(exception) TSRMLS_CC); + } - CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */ + CG(active_op_array)->last -= 2; /* get rid of that ZEND_RETURN and ZEND_HANDLE_EXCEPTION */ CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last; }