]> granicus.if.org Git - php/commitdiff
- Second and last part of #30725 fix
authorMarcus Boerger <helly@php.net>
Mon, 24 Jan 2005 20:02:55 +0000 (20:02 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 24 Jan 2005 20:02:55 +0000 (20:02 +0000)
Zend/tests/bug30725.phpt
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 511ab815f3e417e7dbd4ad50e04e6448569ae531..ce6c9a50a260910a3a6322cb9d5517c50846b8a5 100755 (executable)
@@ -27,6 +27,6 @@ catch(Exception $e)
 
 ?>
 ===DONE===
----EXPECT---
+--EXPECT--
 Caught
 ===DONE===
index 304b4e6740889d737369d5aa2664dd748b013c63..7a23a5cbb3cf68061bd590c8c9c9f9b13c51f76e 100644 (file)
@@ -2863,10 +2863,13 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
        if (ce && ce->get_iterator) {
                iter = ce->get_iterator(ce, array_ptr TSRMLS_CC);
 
-               if (iter) {
+               if (iter && !EG(exception)) {
                        array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
                } else {
-                       array_ptr->refcount++;
+                       zval_ptr_dtor(&array_ptr);
+                       if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+                       zend_throw_exception_internal(NULL TSRMLS_CC);
+                       ZEND_VM_NEXT_OPCODE();
                }
        }
 
index ebb49e13d6064a4e956b9cfd29434186eb46d9ad..6f1cdc7cb143a3e573084d5b9d486a0d6071163a 100644 (file)
@@ -1959,10 +1959,13 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        if (ce && ce->get_iterator) {
                iter = ce->get_iterator(ce, array_ptr TSRMLS_CC);
 
-               if (iter) {
+               if (iter && !EG(exception)) {
                        array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
                } else {
-                       array_ptr->refcount++;
+                       zval_ptr_dtor(&array_ptr);
+                       if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+                       zend_throw_exception_internal(NULL TSRMLS_CC);
+                       ZEND_VM_NEXT_OPCODE();
                }
        }
 
@@ -4368,10 +4371,13 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        if (ce && ce->get_iterator) {
                iter = ce->get_iterator(ce, array_ptr TSRMLS_CC);
 
-               if (iter) {
+               if (iter && !EG(exception)) {
                        array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
                } else {
-                       array_ptr->refcount++;
+                       zval_ptr_dtor(&array_ptr);
+                       if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+                       zend_throw_exception_internal(NULL TSRMLS_CC);
+                       ZEND_VM_NEXT_OPCODE();
                }
        }
 
@@ -7439,10 +7445,13 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        if (ce && ce->get_iterator) {
                iter = ce->get_iterator(ce, array_ptr TSRMLS_CC);
 
-               if (iter) {
+               if (iter && !EG(exception)) {
                        array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
                } else {
-                       array_ptr->refcount++;
+                       zval_ptr_dtor(&array_ptr);
+                       if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+                       zend_throw_exception_internal(NULL TSRMLS_CC);
+                       ZEND_VM_NEXT_OPCODE();
                }
        }
 
@@ -18208,10 +18217,13 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        if (ce && ce->get_iterator) {
                iter = ce->get_iterator(ce, array_ptr TSRMLS_CC);
 
-               if (iter) {
+               if (iter && !EG(exception)) {
                        array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
                } else {
-                       array_ptr->refcount++;
+                       zval_ptr_dtor(&array_ptr);
+                       if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+                       zend_throw_exception_internal(NULL TSRMLS_CC);
+                       ZEND_VM_NEXT_OPCODE();
                }
        }
 
@@ -30500,10 +30512,13 @@ static int ZEND_FE_RESET_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        if (ce && ce->get_iterator) {
                iter = ce->get_iterator(ce, array_ptr TSRMLS_CC);
 
-               if (iter) {
+               if (iter && !EG(exception)) {
                        array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
                } else {
-                       array_ptr->refcount++;
+                       zval_ptr_dtor(&array_ptr);
+                       if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
+                       zend_throw_exception_internal(NULL TSRMLS_CC);
+                       ZEND_VM_NEXT_OPCODE();
                }
        }