Skip to content

Commit bda1ee9

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix FETCH_OBJ_IS type inference
2 parents 703bd89 + a49a309 commit bda1ee9

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
@@ -3502,6 +3502,10 @@ static zend_always_inline int _zend_update_type_info(
35023502
tmp &= ~MAY_BE_RC1;
35033503
}
35043504
}
3505+
if (opline->opcode == ZEND_FETCH_OBJ_IS) {
3506+
/* IS check may return null for uninitialized typed property. */
3507+
tmp |= MAY_BE_NULL;
3508+
}
35053509
}
35063510
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
35073511
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)