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:
1
NEWS
1
NEWS
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
17
ext/opcache/tests/opt/gh8074.phpt
Normal file
17
ext/opcache/tests/opt/gh8074.phpt
Normal 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)
|
||||
Reference in New Issue
Block a user