Fixed double ZEND_TICKS opcode generation for declare()

This commit is contained in:
Julien Pauli 2015-07-06 15:46:48 +02:00
parent 022068342b
commit c22da81b71
2 changed files with 23 additions and 0 deletions

View File

@ -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

View File

@ -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;