1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00

Merge branch 'PHP-8.1'

* PHP-8.1:
  Preserve key/value type invariant in range() type inference
This commit is contained in:
Nikita Popov
2021-10-11 12:42:06 +02:00
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -61,7 +61,7 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
uint32_t t2 = _ssa_op1_info(op_array, ssa, call_info->arg_info[1].opline,
&ssa->ops[call_info->arg_info[1].opline - op_array->opcodes]);
uint32_t t3 = 0;
uint32_t tmp = MAY_BE_RC1 | MAY_BE_ARRAY | MAY_BE_ARRAY_PACKED;
uint32_t tmp = MAY_BE_RC1 | MAY_BE_ARRAY;
if (call_info->num_args == 3) {
t3 = _ssa_op1_info(op_array, ssa, call_info->arg_info[2].opline,
@@ -81,6 +81,9 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
tmp |= MAY_BE_ARRAY_OF_LONG;
}
}
if (tmp & MAY_BE_ARRAY_OF_ANY) {
tmp |= MAY_BE_ARRAY_PACKED;
}
return tmp;
} else {
/* May throw */
@@ -19,6 +19,9 @@ function test2() {
function test3() {
foreach (range(0, $undef) as $v) { }
}
function test4() {
var_dump(range(0, ~$u));
}
?>
===DONE===