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

Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix GH-8074: Wrong type inference of range() result
This commit is contained in:
Christoph M. Becker
2022-02-22 10:20:13 +01:00
3 changed files with 20 additions and 2 deletions

1
NEWS
View File

@@ -8,6 +8,7 @@ PHP NEWS
. Fixed bug GH-8083 Segfault when dumping uncalled fake closure with static
variables. (ilutov)
. Fixed bug GH-7958 (Nested CallbackFilterIterator is leaking memory). (cmb)
. Fixed bug GH-8074 (Wrong type inference of range() result). (cmb)
- GD:
. Fixed libpng warning when loading interlaced images. (Brett)

View File

@@ -75,8 +75,8 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
|| (t3 & (MAY_BE_DOUBLE|MAY_BE_STRING))) {
tmp |= MAY_BE_ARRAY_OF_DOUBLE;
}
if ((t1 & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_STRING|MAY_BE_DOUBLE)))
&& (t2 & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_STRING|MAY_BE_DOUBLE)))) {
if ((t1 & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))
&& (t2 & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))) {
if ((t3 & MAY_BE_ANY) != MAY_BE_DOUBLE) {
tmp |= MAY_BE_ARRAY_OF_LONG;
}

View File

@@ -0,0 +1,17 @@
--TEST--
GH-8074 (Wrong type inference of range() result)
--FILE--
<?php
function test() {
$array = range(1, "2");
foreach ($array as $i) {
var_dump($i + 1);
}
}
test();
?>
--EXPECT--
int(2)
int(3)