mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Merge branch 'PHP-8.1'
* PHP-8.1: Fix type inference
This commit is contained in:
commit
71814e9d99
@ -1961,6 +1961,9 @@ static uint32_t assign_dim_array_result_type(
|
|||||||
value_type |= MAY_BE_NULL;
|
value_type |= MAY_BE_NULL;
|
||||||
}
|
}
|
||||||
if (dim_op_type == IS_UNUSED) {
|
if (dim_op_type == IS_UNUSED) {
|
||||||
|
if (arr_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
|
||||||
|
tmp |= MAY_BE_ARRAY_PACKED;
|
||||||
|
}
|
||||||
tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
|
tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
|
||||||
} else {
|
} else {
|
||||||
if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
|
if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
|
||||||
|
19
ext/opcache/tests/opt/inference_013.phpt
Normal file
19
ext/opcache/tests/opt/inference_013.phpt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
--TEST--
|
||||||
|
Type inference 013: ASSIGN_DIM
|
||||||
|
--INI--
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.optimization_level=-1
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
function y(){
|
||||||
|
for(;;){
|
||||||
|
$x[] &= y;
|
||||||
|
$x = false;
|
||||||
|
$x[""] = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
DONE
|
||||||
|
--EXPECT--
|
||||||
|
DONE
|
Loading…
Reference in New Issue
Block a user