mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-17500: Segfault with requesting nodeName on nameless doctype
This commit is contained in:
commit
5471f117c5
2 changed files with 21 additions and 1 deletions
|
@ -102,11 +102,17 @@ zend_result dom_node_node_name_read(dom_object *obj, zval *retval)
|
|||
}
|
||||
case XML_DOCUMENT_TYPE_NODE:
|
||||
case XML_DTD_NODE:
|
||||
if (nodep->name) {
|
||||
ZVAL_STRING(retval, (const char *) nodep->name);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(retval);
|
||||
}
|
||||
break;
|
||||
case XML_PI_NODE:
|
||||
case XML_ENTITY_DECL:
|
||||
case XML_ENTITY_REF_NODE:
|
||||
case XML_NOTATION_NODE:
|
||||
ZVAL_STRING(retval, (char *) nodep->name);
|
||||
ZVAL_STRING(retval, (const char *) nodep->name);
|
||||
break;
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
ZVAL_STRING(retval, "#cdata-section");
|
||||
|
|
14
ext/dom/tests/gh17500.phpt
Normal file
14
ext/dom/tests/gh17500.phpt
Normal file
|
@ -0,0 +1,14 @@
|
|||
--TEST--
|
||||
GH-17500 (Segfault with requesting nodeName on nameless doctype)
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTML("<!DOCTYPE>", LIBXML_NOERROR);
|
||||
var_dump($doc->doctype->nodeName);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
Loading…
Add table
Add a link
Reference in a new issue