Skip to content

Commit db34e2a

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Trcing JIT: remove unchecked type guards om ROPE_* instructions
2 parents 6156505 + 33704be commit db34e2a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,9 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
20732073
case ZEND_ROPE_INIT:
20742074
case ZEND_ROPE_ADD:
20752075
case ZEND_ROPE_END:
2076-
ADD_OP2_TRACE_GUARD();
2076+
if (op2_type == IS_STRING) {
2077+
ADD_OP2_TRACE_GUARD();
2078+
}
20772079
break;
20782080
default:
20792081
break;

ext/opcache/tests/jit/rope_002.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
JIT ROPE: 002 type guards are only checked for strings
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
function foo() {
11+
$a = 0;
12+
for ($cnt = 0; $cnt < 6; $cnt++) {
13+
$array[] = &$y;
14+
$S["$array[$a] $y"] = $a += $y;
15+
}
16+
}
17+
foo();
18+
?>
19+
DONE
20+
--EXPECT--
21+
DONE

0 commit comments

Comments
 (0)