Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Fix GH-16808: Segmentation fault in RecursiveIteratorIterator->current() with a xml element input
This commit is contained in:
Niels Dossche 2024-11-16 13:41:29 +01:00
commit 2ba18590bf
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
3 changed files with 21 additions and 1 deletions

4
NEWS
View file

@ -40,6 +40,10 @@ PHP NEWS
. Fixed bug GH-16695 (phar:// tar parser and zero-length file header blocks). . Fixed bug GH-16695 (phar:// tar parser and zero-length file header blocks).
(nielsdos, Hans Krentel) (nielsdos, Hans Krentel)
- SimpleXML:
. Fixed bug GH-16808 (Segmentation fault in RecursiveIteratorIterator
->current() with a xml element input). (nielsdos)
- SOAP: - SOAP:
. Fix make check being invoked in ext/soap. (Ma27) . Fix make check being invoked in ext/soap. (Ma27)

View file

@ -2532,7 +2532,11 @@ static zval *php_sxe_iterator_current_data(zend_object_iterator *iter) /* {{{ */
{ {
php_sxe_iterator *iterator = (php_sxe_iterator *)iter; php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
return &iterator->sxe->iter.data; zval *data = &iterator->sxe->iter.data;
if (Z_ISUNDEF_P(data)) {
return NULL;
}
return data;
} }
/* }}} */ /* }}} */

View file

@ -0,0 +1,12 @@
--TEST--
GH-16808 (Segmentation fault in RecursiveIteratorIterator->current() with a xml element input)
--EXTENSIONS--
simplexml
--FILE--
<?php
$sxe = new SimpleXMLElement("<root />");
$test = new RecursiveIteratorIterator($sxe);
var_dump($test->current());
?>
--EXPECT--
NULL