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:
@@ -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();
|
||||
}
|
||||
|
||||
19
ext/xsl/tests/gh19988.phpt
Normal file
19
ext/xsl/tests/gh19988.phpt
Normal 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) ""
|
||||
Reference in New Issue
Block a user