Skip to content

Commit

Permalink
Fixed type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Sep 22, 2021
1 parent 7a93a8a commit e588f24
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/opcache/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -2754,6 +2754,9 @@ static zend_always_inline int _zend_update_type_info(
if (t1 & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_STRING)) {
tmp |= (OP1_DATA_INFO() & (MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF));

if (OP1_DATA_INFO() & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
}
if (opline->op2_type == IS_UNUSED) {
/* When appending to an array and the LONG_MAX key is already used
* null will be returned. */
Expand Down
20 changes: 20 additions & 0 deletions ext/opcache/tests/jit/assign_dim_003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
JIT ASSIGN_DIM: 003
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.jit=tracing
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function test() {
var_dump($a[0] = $v);
}
test();
?>
--EXPECTF--
Warning: Undefined variable $v in %sassign_dim_003.php on line 3
NULL

0 comments on commit e588f24

Please sign in to comment.