mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix GH-8366: ArrayIterator may leak when calling __construct()
This commit is contained in:
commit
549cf3a24d
3 changed files with 17 additions and 1 deletions
4
NEWS
4
NEWS
|
@ -26,6 +26,10 @@ PHP NEWS
|
||||||
. Fixed bug GH-8267 (MySQLi uses unsupported format specifier on Windows).
|
. Fixed bug GH-8267 (MySQLi uses unsupported format specifier on Windows).
|
||||||
(cmb)
|
(cmb)
|
||||||
|
|
||||||
|
- SPL:
|
||||||
|
. Fixed bug GH-8366 (ArrayIterator may leak when calling __construct()).
|
||||||
|
(cmb)
|
||||||
|
|
||||||
- Streams:
|
- Streams:
|
||||||
. Fixed php://temp does not preserve file-position when switched to temporary
|
. Fixed php://temp does not preserve file-position when switched to temporary
|
||||||
file. (Bernd Holzmüller)
|
file. (Bernd Holzmüller)
|
||||||
|
|
|
@ -1088,7 +1088,10 @@ static void spl_array_set_array(zval *object, spl_array_object *intern, zval *ar
|
||||||
|
|
||||||
intern->ar_flags &= ~SPL_ARRAY_IS_SELF & ~SPL_ARRAY_USE_OTHER;
|
intern->ar_flags &= ~SPL_ARRAY_IS_SELF & ~SPL_ARRAY_USE_OTHER;
|
||||||
intern->ar_flags |= ar_flags;
|
intern->ar_flags |= ar_flags;
|
||||||
intern->ht_iter = (uint32_t)-1;
|
if (intern->ht_iter != (uint32_t)-1) {
|
||||||
|
zend_hash_iterator_del(intern->ht_iter);
|
||||||
|
intern->ht_iter = (uint32_t)-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
9
ext/spl/tests/gh8366.phpt
Normal file
9
ext/spl/tests/gh8366.phpt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
--TEST--
|
||||||
|
Bug GH-8366 (ArrayIterator may leak when calling __construct())
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$it = new \ArrayIterator();
|
||||||
|
foreach ($it as $elt) {}
|
||||||
|
$it->__construct([]);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
Loading…
Add table
Add a link
Reference in a new issue