Skip to content

Commit 90b91d3

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-15658: Segmentation fault in Zend/zend_vm_execute.h
2 parents f56a659 + d2a5c98 commit 90b91d3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2537,7 +2537,13 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
25372537
case ZEND_OP_DATA:
25382538
case ZEND_SWITCH_LONG:
25392539
case ZEND_SWITCH_STRING:
2540+
break;
25402541
case ZEND_MATCH:
2542+
/* We have to exit to the VM because the MATCH handler performs an N-way jump for
2543+
* which we can't generate simple (opcache.jit=1201) JIT code. */
2544+
if (!zend_jit_tail_handler(&dasm_state, opline)) {
2545+
goto jit_failure;
2546+
}
25412547
break;
25422548
case ZEND_JMP:
25432549
if (JIT_G(opt_level) < ZEND_JIT_LEVEL_INLINE) {

ext/opcache/tests/jit/gh15658.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
GH-15658 (Segmentation fault in Zend/zend_vm_execute.h)
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.jit=0101
7+
opcache.jit_buffer_size=1024M
8+
--FILE--
9+
<?php
10+
echo match (random_int(1, 2)) {
11+
1, 2 => 'foo',
12+
};
13+
?>
14+
--EXPECT--
15+
foo

0 commit comments

Comments
 (0)