mirror of
https://github.com/php/php-src.git
synced 2024-11-26 19:33:55 +08:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix type inference for FETCH_DI_UNSET
This commit is contained in:
commit
b734d45626
@ -3348,7 +3348,12 @@ static zend_always_inline int _zend_update_type_info(
|
||||
ZEND_ASSERT(j < 0 && "There should only be one use");
|
||||
}
|
||||
}
|
||||
if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY)) || opline->opcode == ZEND_FETCH_DIM_FUNC_ARG) {
|
||||
if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY))
|
||||
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
|
||||
|| opline->opcode == ZEND_FETCH_DIM_R
|
||||
|| opline->opcode == ZEND_FETCH_DIM_IS
|
||||
|| opline->opcode == ZEND_FETCH_DIM_UNSET
|
||||
|| opline->opcode == ZEND_FETCH_LIST_R) {
|
||||
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
|
||||
} else {
|
||||
/* invalid key type */
|
||||
|
26
ext/opcache/tests/opt/inference_012.phpt
Normal file
26
ext/opcache/tests/opt/inference_012.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Type inference 012: FETCH_DIM_UNSET
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--FILE--
|
||||
<?php
|
||||
function test() {
|
||||
$closure = function() {return "string";};
|
||||
unset($x['b'][$closure()]['d']);
|
||||
$x = $arr;
|
||||
$arr = ['a' => $closure(), 'b' => [$closure() => []]];
|
||||
$x = $arr;
|
||||
unset($x['b'][$closure()]['d']);
|
||||
$x = $arr;
|
||||
}
|
||||
|
||||
test();
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: Undefined variable $x in %sinference_012.php on line 4
|
||||
|
||||
Warning: Undefined variable $arr in %sinference_012.php on line 5
|
||||
DONE
|
Loading…
Reference in New Issue
Block a user