diff options
author | Julien Pauli <jpauli@php.net> | 2015-07-07 15:03:58 +0200 |
---|---|---|
committer | Julien Pauli <jpauli@php.net> | 2015-07-07 15:03:58 +0200 |
commit | dfb0c6363fd1a4bd75849e4637d7fd31dfc42857 (patch) | |
tree | 262836bef90c4d9a25e1c318b0b8d4e21b091c38 | |
parent | 404dc93d35f7061fc4b1b41ad6cb0721b9b52bcc (diff) | |
parent | c22da81b71abe8c41a94fdea4e95a2bca8ec926d (diff) | |
download | php-git-dfb0c6363fd1a4bd75849e4637d7fd31dfc42857.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
Fixed double ZEND_TICKS opcode generation for declare()
Conflicts:
Zend/zend_compile.c
-rw-r--r-- | Zend/tests/declare_005.phpt | 18 | ||||
-rw-r--r-- | Zend/zend_compile.c | 5 |
2 files changed, 23 insertions, 0 deletions
diff --git a/Zend/tests/declare_005.phpt b/Zend/tests/declare_005.phpt new file mode 100644 index 0000000000..8f5adcfbd2 --- /dev/null +++ b/Zend/tests/declare_005.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing declare statement with ticks +--SKIPIF-- +--FILE-- +<?php +register_tick_function(function () { echo "tick\n"; }); +function foo() { } + +declare(ticks=1) { + +$statement; +foo(); + +} +?> +--EXPECTF-- +tick +tick diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e655e8480c..3ae9567a94 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1881,6 +1881,11 @@ static zend_op *zend_emit_op_tmp(znode *result, zend_uchar opcode, znode *op1, z static void zend_emit_tick(void) /* {{{ */ { + /* 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)); opline->opcode = ZEND_TICKS; |