mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fixed double ZEND_TICKS opcode generation for declare()
This commit is contained in:
parent
022068342b
commit
c22da81b71
18
Zend/tests/declare_005.phpt
Normal file
18
Zend/tests/declare_005.phpt
Normal 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
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user