Skip to content

Commit 5860a39

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fixed JIT for FETCH_OBJ when op1 is a reference of non-object
2 parents f2ceb63 + 7a93a8a commit 5860a39

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
@@ -4485,6 +4485,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
44854485
} else {
44864486
CHECK_OP1_TRACE_TYPE();
44874487
}
4488+
if (!(op1_info & MAY_BE_OBJECT)) {
4489+
break;
4490+
}
44884491
if (ssa->var_info && ssa->ops) {
44894492
if (ssa_op->op1_use >= 0) {
44904493
zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
@@ -4557,6 +4560,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
45574560
} else {
45584561
CHECK_OP1_TRACE_TYPE();
45594562
}
4563+
if (!(op1_info & MAY_BE_OBJECT)) {
4564+
break;
4565+
}
45604566
if (ssa->var_info && ssa->ops) {
45614567
if (ssa_op->op1_use >= 0) {
45624568
zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
@@ -4624,6 +4630,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
46244630
} else {
46254631
CHECK_OP1_TRACE_TYPE();
46264632
}
4633+
if (!(op1_info & MAY_BE_OBJECT)) {
4634+
break;
4635+
}
46274636
if (ssa->var_info && ssa->ops) {
46284637
if (ssa_op->op1_use >= 0) {
46294638
zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
@@ -5555,9 +5564,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
55555564
}
55565565
} else {
55575566
CHECK_OP1_TRACE_TYPE();
5558-
if (!(op1_info & MAY_BE_OBJECT)) {
5559-
break;
5560-
}
5567+
}
5568+
if (!(op1_info & MAY_BE_OBJECT)) {
5569+
break;
55615570
}
55625571
if (ssa->var_info && ssa->ops) {
55635572
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)