dmitry                                   Mon, 24 May 2010 14:46:31 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299693

Log:
Fixed exception handling in GOTO VM

Changed paths:
    U   php/php-src/trunk/Zend/zend_vm_def.h
    U   php/php-src/trunk/Zend/zend_vm_execute.h

Modified: php/php-src/trunk/Zend/zend_vm_def.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_def.h        2010-05-24 14:11:39 UTC (rev 
299692)
+++ php/php-src/trunk/Zend/zend_vm_def.h        2010-05-24 14:46:31 UTC (rev 
299693)
@@ -2895,6 +2895,7 @@
 {
        USE_OPLINE
        zend_class_entry *ce, *catch_ce;
+       zval *exception;

        SAVE_OPLINE();
        /* Check whether an exception has been thrown, if not, jump over code */
@@ -2928,6 +2929,7 @@
                }
        }

+       exception = EG(exception);
        if (!EG(active_symbol_table)) {
                if (EX_CV(opline->op2.var)) {
                        zval_ptr_dtor(EX_CV(opline->op2.var));
@@ -2939,8 +2941,13 @@
                zend_hash_quick_update(EG(active_symbol_table), cv->name, 
cv->name_len+1, cv->hash_value,
                    &EG(exception), sizeof(zval *), 
(void**)&EX_CV(opline->op2.var));
        }
-       EG(exception) = NULL;
-       ZEND_VM_NEXT_OPCODE();
+       if (UNEXPECTED(EG(exception) != exception)) {
+               EG(exception) = NULL;
+               HANDLE_EXCEPTION();
+       } else {
+               EG(exception) = NULL;
+               ZEND_VM_NEXT_OPCODE();
+       }
 }

 ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP|VAR|CV, ANY)

Modified: php/php-src/trunk/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_execute.h    2010-05-24 14:11:39 UTC (rev 
299692)
+++ php/php-src/trunk/Zend/zend_vm_execute.h    2010-05-24 14:46:31 UTC (rev 
299693)
@@ -5628,6 +5628,7 @@
 {
        USE_OPLINE
        zend_class_entry *ce, *catch_ce;
+       zval *exception;

        SAVE_OPLINE();
        /* Check whether an exception has been thrown, if not, jump over code */
@@ -5661,6 +5662,7 @@
                }
        }

+       exception = EG(exception);
        if (!EG(active_symbol_table)) {
                if (EX_CV(opline->op2.var)) {
                        zval_ptr_dtor(EX_CV(opline->op2.var));
@@ -5672,8 +5674,13 @@
                zend_hash_quick_update(EG(active_symbol_table), cv->name, 
cv->name_len+1, cv->hash_value,
                    &EG(exception), sizeof(zval *), 
(void**)&EX_CV(opline->op2.var));
        }
-       EG(exception) = NULL;
-       ZEND_VM_NEXT_OPCODE();
+       if (UNEXPECTED(EG(exception) != exception)) {
+               EG(exception) = NULL;
+               HANDLE_EXCEPTION();
+       } else {
+               EG(exception) = NULL;
+               ZEND_VM_NEXT_OPCODE();
+       }
 }

 static int ZEND_FASTCALL  
ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to