From a069a415e575e4b5fcfdb61a1bc388b7f03345b2 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 1 Nov 2007 11:59:15 +0000 Subject: [PATCH] Fixed bug #43027 (Declare cause fatal error) --- Zend/tests/bug43027.phpt | 10 ++++++++++ Zend/zend_compile.c | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100755 Zend/tests/bug43027.phpt diff --git a/Zend/tests/bug43027.phpt b/Zend/tests/bug43027.phpt new file mode 100755 index 0000000000..2cf2d1d6a5 --- /dev/null +++ b/Zend/tests/bug43027.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #43027 (Declare cause fatal error) +--FILE-- + +--EXPECT-- +ok diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 963f7c2d1e..f8c956664f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4496,10 +4496,11 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ * want to tell them to put declare() at the top. */ if (CG(active_op_array)->last > 0) { - /* ignore ZEND_EXT_STMT */ + /* ignore ZEND_EXT_STMT and ZEND_TICKS */ int num = CG(active_op_array)->last; while (num > 0 && - CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT) { + (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT || + CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) { --num; } if (num > 0) { @@ -5075,10 +5076,11 @@ void zend_do_namespace(znode *name TSRMLS_DC) /* {{{ */ zstr lcname; if (CG(active_op_array)->last > 0) { - /* ignore ZEND_EXT_STMT */ + /* ignore ZEND_EXT_STMT and ZEND_TICKS */ int num = CG(active_op_array)->last; while (num > 0 && - CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT) { + (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT || + CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) { --num; } if (num > 0) { -- 2.50.1