Skip to content

Commit 7c8b3b2

Browse files
committed
Fix phpGH-15821: Core dumped in Zend/Optimizer/zend_inference.c:4062
1 parent 025ed70 commit 7c8b3b2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4056,11 +4056,11 @@ static zend_always_inline zend_result _zend_update_type_info(
40564056
fprintf(stderr, "Missing op2 type inference for opcode %s, line %d\n", zend_get_opcode_name(opline->opcode), opline->lineno);
40574057
}
40584058
#endif
4059-
unknown_opcode:
40604059
if (ssa_op->op1_def >= 0) {
40614060
tmp = MAY_BE_ANY | MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
40624061
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
40634062
}
4063+
unknown_opcode:
40644064
if (ssa_op->result_def >= 0) {
40654065
tmp = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
40664066
if (opline->result_type == IS_TMP_VAR) {

ext/opcache/tests/jit/gh15821.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-15821 (Core dumped in Zend/Optimizer/zend_inference.c:4062)
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.jit=1203
7+
opcache.jit_buffer_size=64M
8+
--FILE--
9+
<?php
10+
$allInternalFunctions = array();
11+
$definedFunctions = get_defined_functions();
12+
$internalFunctions = $definedFunctions['internal'];
13+
$allInternalFunctions = array_merge($allInternalFunctions, $internalFunctions);
14+
$allInternalFunctions = array_filter($allInternalFunctions, function($func) {
15+
strpos($func, 'posix_') !== 0;
16+
});
17+
echo "Done\n";
18+
?>
19+
--EXPECT--
20+
Done

0 commit comments

Comments
 (0)