mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Try to use an interned local name in createElementNS (#14127)
This commit is contained in:
parent
234b3cb241
commit
22a113b99c
1 changed files with 11 additions and 1 deletions
|
@ -912,7 +912,17 @@ PHP_METHOD(DOM_Document, createElementNS)
|
|||
if (errorcode == 0) {
|
||||
php_dom_libxml_ns_mapper *ns_mapper = php_dom_get_ns_mapper(intern);
|
||||
xmlNsPtr ns = php_dom_libxml_ns_mapper_get_ns_raw_prefix_string(ns_mapper, prefix, xmlStrlen(prefix), uri);
|
||||
xmlNodePtr nodep = xmlNewDocNodeEatName(docp, ns, localname, NULL);
|
||||
|
||||
/* Try to create the node with the local name interned. */
|
||||
const xmlChar *interned_localname = xmlDictLookup(docp->dict, localname, -1);
|
||||
xmlNodePtr nodep;
|
||||
if (interned_localname == NULL) {
|
||||
nodep = xmlNewDocNodeEatName(docp, ns, localname, NULL);
|
||||
} else {
|
||||
xmlFree(localname);
|
||||
nodep = xmlNewDocNodeEatName(docp, ns, BAD_CAST interned_localname, NULL);
|
||||
}
|
||||
|
||||
if (UNEXPECTED(nodep == NULL)) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, /* strict */ true);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue