mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Merge branch 'PHP-8.1'
* PHP-8.1: Fix type inference
This commit is contained in:
commit
89fa77516c
@ -3253,7 +3253,12 @@ static zend_always_inline zend_result _zend_update_type_info(
|
||||
tmp |= t1 & (MAY_BE_RC1|MAY_BE_RCN);
|
||||
}
|
||||
if (opline->op2_type == IS_UNUSED) {
|
||||
key_type |= MAY_BE_HASH_ONLY(t1) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
|
||||
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL)) {
|
||||
key_type |= MAY_BE_ARRAY_PACKED;
|
||||
}
|
||||
if (t1 & MAY_BE_ARRAY) {
|
||||
key_type |= MAY_BE_HASH_ONLY(t1) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
|
||||
}
|
||||
} else {
|
||||
if (t2 & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
|
||||
key_type |= MAY_BE_HASH_ONLY(t1) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
|
||||
|
18
ext/opcache/tests/opt/inference_007.phpt
Normal file
18
ext/opcache/tests/opt/inference_007.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Type inference 007: Incorrect array key type inference
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--FILE--
|
||||
<?php
|
||||
function y() {
|
||||
for(;;) {
|
||||
s($array[]);
|
||||
$array = array(""=>"");
|
||||
}
|
||||
}
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
Loading…
Reference in New Issue
Block a user