Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix GH-8235: iterator_count() may run indefinitely
This commit is contained in:
Christoph M. Becker 2022-05-03 12:59:07 +02:00
commit e004e1a93b
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
2 changed files with 6 additions and 0 deletions

3
NEWS
View file

@ -5,6 +5,9 @@ PHP NEWS
- FPM:
. Fixed ACL build check on MacOS. (David Carlier)
- SPL:
. Fixed bug GH-8235 (iterator_count() may run indefinitely). (cmb)
- Zip:
. Fixed type for index in ZipArchive::replaceFile. (Martin Rehberger)

View file

@ -3127,6 +3127,9 @@ PHP_FUNCTION(iterator_to_array)
static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser) /* {{{ */
{
if (UNEXPECTED(*(zend_long*)puser == ZEND_LONG_MAX)) {
return ZEND_HASH_APPLY_STOP;
}
(*(zend_long*)puser)++;
return ZEND_HASH_APPLY_KEEP;
}