]> granicus.if.org Git - php/commitdiff
Bugfix #28464 catch() does not catch exceptions by interfaces
authorMarcus Boerger <helly@php.net>
Fri, 16 Jul 2004 06:39:50 +0000 (06:39 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 16 Jul 2004 06:39:50 +0000 (06:39 +0000)
Zend/zend_execute.c

index 026b635a953670f971723e038d44320502c9c9c0..a958a1be6014ca6cde7a5183adeef6e9d7f6df71 100644 (file)
@@ -2929,21 +2929,16 @@ int zend_catch_handler(ZEND_OPCODE_HANDLER_ARGS)
        }
        ce = Z_OBJCE_P(EG(exception));
        if (ce != EX_T(opline->op1.u.var).class_entry) {
-               while (ce->parent) {
-                       if (ce->parent == EX_T(opline->op1.u.var).class_entry) {
-                               goto exception_should_be_taken;
+               if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) {
+                       if (opline->op1.u.EA.type) {
+                               zend_throw_exception_internal(NULL TSRMLS_CC);
+                               NEXT_OPCODE();
                        }
-                       ce = ce->parent;
-               }
-               if (opline->op1.u.EA.type) {
-                       zend_throw_exception_internal(NULL TSRMLS_CC);
-                       NEXT_OPCODE();
+                       SET_OPCODE(&op_array->opcodes[opline->extended_value]);
+                       return 0; /* CHECK_ME */
                }
-               SET_OPCODE(&op_array->opcodes[opline->extended_value]);
-               return 0; /* CHECK_ME */
        }
 
-exception_should_be_taken:
        zend_hash_update(EG(active_symbol_table), opline->op2.u.constant.value.str.val,
                opline->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL);
        EG(exception) = NULL;