mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Fixed double ZEND_TICKS opcode generation for declare()
This commit is contained in:
parent
022068342b
commit
c22da81b71
2 changed files with 23 additions and 0 deletions
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) /* {{{ */
|
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);
|
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||||
|
|
||||||
opline->opcode = ZEND_TICKS;
|
opline->opcode = ZEND_TICKS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue