Skip to content

Commit 8d55998

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: JIT: Fixed JIT for FETCH_OBJ when op1 is a reference of non-object
2 parents 41d2b74 + 5860a39 commit 8d55998

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4483,6 +4483,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
44834483
} else {
44844484
CHECK_OP1_TRACE_TYPE();
44854485
}
4486+
if (!(op1_info & MAY_BE_OBJECT)) {
4487+
break;
4488+
}
44864489
if (ssa->var_info && ssa->ops) {
44874490
if (ssa_op->op1_use >= 0) {
44884491
zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
@@ -4555,6 +4558,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
45554558
} else {
45564559
CHECK_OP1_TRACE_TYPE();
45574560
}
4561+
if (!(op1_info & MAY_BE_OBJECT)) {
4562+
break;
4563+
}
45584564
if (ssa->var_info && ssa->ops) {
45594565
if (ssa_op->op1_use >= 0) {
45604566
zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
@@ -4622,6 +4628,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
46224628
} else {
46234629
CHECK_OP1_TRACE_TYPE();
46244630
}
4631+
if (!(op1_info & MAY_BE_OBJECT)) {
4632+
break;
4633+
}
46254634
if (ssa->var_info && ssa->ops) {
46264635
if (ssa_op->op1_use >= 0) {
46274636
zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
@@ -5553,9 +5562,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
55535562
}
55545563
} else {
55555564
CHECK_OP1_TRACE_TYPE();
5556-
if (!(op1_info & MAY_BE_OBJECT)) {
5557-
break;
5558-
}
5565+
}
5566+
if (!(op1_info & MAY_BE_OBJECT)) {
5567+
break;
55595568
}
55605569
if (ssa->var_info && ssa->ops) {
55615570
if (ssa_op->op1_use >= 0) {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
JIT: FETCH_OBJ 005
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.jit=tracing
9+
--EXTENSIONS--
10+
opcache
11+
--FILE--
12+
<?php
13+
for ($i = 0; $i < 3; $i++) {
14+
$a =& $b;
15+
$a->p;
16+
}
17+
?>
18+
--EXPECTF--
19+
Warning: Attempt to read property "p" on null in %sfetch_obj_005.php on line 4
20+
21+
Warning: Attempt to read property "p" on null in %sfetch_obj_005.php on line 4
22+
23+
Warning: Attempt to read property "p" on null in %sfetch_obj_005.php on line 4

0 commit comments

Comments
 (0)