]> granicus.if.org Git - php/commitdiff
Fixed bug #35360 (exceptions in interactive mode (php -a) may cause crash)
authorDmitry Stogov <dmitry@php.net>
Thu, 24 Nov 2005 11:33:11 +0000 (11:33 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 24 Nov 2005 11:33:11 +0000 (11:33 +0000)
NEWS
Zend/zend_compile.c
Zend/zend_execute_API.c

diff --git a/NEWS b/NEWS
index fca4bb6640428604a7be7245b1721c83661da06d..893fe44a08f127256c4fa00fab5fa42fba37d01a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ PHP                                                                        NEWS
 - Added an additional field $frame['object'] to the result array of
   debug_backtrace() that contains a reference to the respective object when the
   frame was called from an object. (Sebastian)
+- Fixed bug #35360 (exceptions in interactive mode (php -a) may cause crash).
+  (Dmitry)
+
 24 Nov 2005, PHP 5.1
 - Added support for class constants and static members for internal classes. 
   (Dmitry, Michael Wallner)
index 93aeb757f8cae1d23f9df0a0d3d120d004cf1873..d0642735bfb624f5ad7efc46a505b8b302644bd0 100644 (file)
@@ -1730,12 +1730,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));
 }
 
 
index dc75f94714bbca877ee9fd9cf0cd8fb0d21ee68e..3e0bd367f15d11acaf55be65fc49aabe78cd9474 100644 (file)
@@ -1115,6 +1115,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;
        }
@@ -1153,7 +1155,11 @@ void execute_new_code(TSRMLS_D)
                zval_ptr_dtor(&local_retval);
        }
 
-       CG(active_op_array)->last--;    /* get rid of that ZEND_RETURN */
+       if (EG(exception)) {
+               zend_exception_error(EG(exception) TSRMLS_CC);
+       }
+
+       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;
 }