1
0
mirror of https://github.com/php/php-src.git synced 2026-04-08 08:33:06 +02:00

Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix type inference
This commit is contained in:
Dmitry Stogov
2022-08-22 21:12:49 +03:00
2 changed files with 22 additions and 0 deletions

View File

@@ -1976,6 +1976,9 @@ static uint32_t assign_dim_array_result_type(
tmp |= MAY_BE_ARRAY_KEY_STRING;
if (dim_op_type != IS_CONST) {
// FIXME: numeric string
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;
}
}

View File

@@ -0,0 +1,19 @@
--TEST--
Type inference 015: ASSIGN_DIM_OP
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--FILE--
<?php
function test() {
for(;;) {
$x[y.y] &= y;
$x = false;
$x[""] = y;
}
}
?>
DONE
--EXPECT--
DONE