diff --git a/Zend/tests/declare_005.phpt b/Zend/tests/declare_005.phpt new file mode 100644 index 00000000000..8f5adcfbd2f --- /dev/null +++ b/Zend/tests/declare_005.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing declare statement with ticks +--SKIPIF-- +--FILE-- + +--EXPECTF-- +tick +tick diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d2f9fbc8d74..278ac4e02e2 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6827,6 +6827,11 @@ void zend_do_extended_fcall_end(TSRMLS_D) /* {{{ */ void zend_do_ticks(TSRMLS_D) /* {{{ */ { + /* This prevents a double TICK generated by the parser statement of "declare()" */ + if (CG(active_op_array)->last && CG(active_op_array)->opcodes[CG(active_op_array)->last - 1].opcode == ZEND_TICKS) { + return; + } + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_TICKS;