Skip to content

Commit e3df312

Browse files
committed
Add regression test for tailcall VM crash
1 parent 63c3394 commit e3df312

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Observer: VM interrupt during tailcall return to caller
3+
--DESCRIPTION--
4+
This exercises a VM interrupt raised immediately before a user function returns
5+
to a caller that invoked it through DO_FCALL. On the tailcall VM, the caller's
6+
saved opline must point to the opcode after DO_FCALL before a pending interrupt
7+
is handled.
8+
--EXTENSIONS--
9+
zend_test
10+
--INI--
11+
opcache.jit=0
12+
zend_test.observer.set_vm_interrupt_on_begin=1
13+
--FILE--
14+
<?php
15+
function interrupt_before_return(VmInterruptComparable $left, VmInterruptComparable $right): void
16+
{
17+
$left < $right;
18+
}
19+
20+
function call_interrupt_before_return(): void
21+
{
22+
interrupt_before_return(new VmInterruptComparable(2), new VmInterruptComparable(1));
23+
}
24+
25+
call_interrupt_before_return();
26+
echo "ok\n";
27+
?>
28+
--EXPECT--
29+
ok

0 commit comments

Comments
 (0)