Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix FETCH_OBJ_IS type inference
This commit is contained in:
Nikita Popov 2021-09-17 17:06:00 +02:00
commit a6615b3419
2 changed files with 28 additions and 0 deletions

View file

@ -3530,6 +3530,10 @@ static zend_always_inline int _zend_update_type_info(
tmp &= ~MAY_BE_RC1;
}
}
if (opline->opcode == ZEND_FETCH_OBJ_IS) {
/* IS check may return null for uninitialized typed property. */
tmp |= MAY_BE_NULL;
}
}
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
if (ce) {

View file

@ -0,0 +1,24 @@
--TEST--
FETCH_OBJ_IS on typed object property
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
class Test {
public stdClass $data;
}
function test() {
$test = new Test;
var_dump(isset($test->data[0]));
}
test();
?>
--EXPECT--
bool(false)