1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.5'

* PHP-8.5:
  Fix NEWS order
  Fix GH-19988: zend_string_init with NULL pointer in simplexml (UB)
This commit is contained in:
Niels Dossche
2025-09-29 16:09:07 +02:00
2 changed files with 20 additions and 1 deletions

View File

@@ -1628,7 +1628,7 @@ PHP_METHOD(SimpleXMLElement, getName)
node = php_sxe_get_first_node_non_destructive(sxe, node);
if (node) {
namelen = xmlStrlen(node->name);
RETURN_STRINGL((char*)node->name, namelen);
RETURN_STRINGL_FAST((const char *) node->name, namelen);
} else {
RETURN_EMPTY_STRING();
}

View File

@@ -0,0 +1,19 @@
--TEST--
GH-19988 (zend_string_init with NULL pointer in simplexml (UB))
--EXTENSIONS--
simplexml
xsl
--CREDITS--
YuanchengJiang
--FILE--
<?php
$sxe = simplexml_load_file(__DIR__ . '/53965/collection.xml');
$processor = new XSLTProcessor;
$dom = new DOMDocument;
$dom->load(__DIR__ . '/53965/collection.xsl');
$processor->importStylesheet($dom);
$result = $processor->transformToDoc($sxe, SimpleXMLElement::class);
var_dump($result->getName());
?>
--EXPECT--
string(0) ""