Skip to content

Commit a6615b3

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix FETCH_OBJ_IS type inference
2 parents 4e139cf + bda1ee9 commit a6615b3

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3530,6 +3530,10 @@ static zend_always_inline int _zend_update_type_info(
35303530
tmp &= ~MAY_BE_RC1;
35313531
}
35323532
}
3533+
if (opline->opcode == ZEND_FETCH_OBJ_IS) {
3534+
/* IS check may return null for uninitialized typed property. */
3535+
tmp |= MAY_BE_NULL;
3536+
}
35333537
}
35343538
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
35353539
if (ce) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
FETCH_OBJ_IS on typed object property
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+
11+
class Test {
12+
public stdClass $data;
13+
}
14+
15+
function test() {
16+
$test = new Test;
17+
var_dump(isset($test->data[0]));
18+
}
19+
20+
test();
21+
22+
?>
23+
--EXPECT--
24+
bool(false)

0 commit comments

Comments
 (0)