diff options
| author | Andi Gutmans <andi@php.net> | 2002-02-13 19:26:07 +0000 |
|---|---|---|
| committer | Andi Gutmans <andi@php.net> | 2002-02-13 19:26:07 +0000 |
| commit | 21b04ff2a6cf1b6f8e9a50d538d7ae41a5c50214 (patch) | |
| tree | f0a6d32f9f21097980ce08a626b46d3465685b4b /Zend/zend_compile.c | |
| parent | d43e8898547184c3031f74cf2e93fdad59502a18 (diff) | |
| download | php-git-21b04ff2a6cf1b6f8e9a50d538d7ae41a5c50214.tar.gz | |
@ Allow a series of consecutive catch() statements (Andi, Zend Engine)
<?php
class MyException1 {
}
class MyException2 {
}
try {
throw new MyException2();
} catch (MyException1 $m) {
print "Caught MyException1";
} catch (MyException2 $m) {
print "Caught MyException2";
}
Diffstat (limited to 'Zend/zend_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b4010ea1a4..865cdfc1dc 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1255,7 +1255,7 @@ static void throw_list_applier(long *opline_num, long *catch_opline) } } -void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var TSRMLS_DC) +void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC) { long catch_op_number = get_next_op_number(CG(active_op_array)); zend_op *opline; @@ -1266,11 +1266,12 @@ void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var SET_UNUSED(opline->op1); /* FIXME: Define IS_CLASS or something like that */ opline->op2 = *catch_var; - zend_llist_apply_with_argument(CG(throw_list), (llist_apply_with_arg_func_t) throw_list_applier, &CG(catch_begin) TSRMLS_CC); - zend_llist_destroy(CG(throw_list)); - efree(CG(throw_list)); - CG(throw_list) = (void *) try_token->throw_list; - + if (first_catch) { + zend_llist_apply_with_argument(CG(throw_list), (llist_apply_with_arg_func_t) throw_list_applier, &CG(catch_begin) TSRMLS_CC); + zend_llist_destroy(CG(throw_list)); + efree(CG(throw_list)); + CG(throw_list) = (void *) try_token->throw_list; + } try_token->u.opline_num = catch_op_number; } |
