diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index ffdae3701aa..e435e35add7 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -147,6 +147,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES - php_dom_create_object() now no longer accepts a NULL obj argument. - Removed the `ret` argument from the DOM_RET_OBJ macro, use the return value instead. + - Removed DOM_XMLNS_NAMESPACE from xml_common.h. Use DOM_XMLNS_NS_URI + from namespace_compat.h instead. b. ext/random - The macro RAND_RANGE_BADSCALING() has been removed. The implementation diff --git a/ext/dom/element.c b/ext/dom/element.c index bcd7fa38d18..d553f6fd634 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -814,7 +814,7 @@ static const xmlChar *dom_get_attribute_ns(dom_object *intern, xmlNodePtr elemp, *should_free_result = true; return strattr; } else { - if (!follow_spec && xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NAMESPACE)) { + if (!follow_spec && xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NS_URI)) { xmlNsPtr nsptr = dom_get_nsdecl(elemp, BAD_CAST name); if (nsptr != NULL) { return nsptr->href; @@ -887,7 +887,7 @@ static void dom_set_attribute_ns_legacy(dom_object *intern, xmlNodePtr elemp, ch if ((xmlStrEqual(BAD_CAST prefix, BAD_CAST "xmlns") || (prefix == NULL && xmlStrEqual(BAD_CAST localname, BAD_CAST "xmlns"))) && - xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NAMESPACE)) { + xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NS_URI)) { is_xmlns = 1; if (prefix == NULL) { nsptr = dom_get_nsdecl(elemp, NULL); @@ -1152,7 +1152,7 @@ PHP_METHOD(DOMElement, getAttributeNodeNS) attrp = xmlHasNsProp(elemp, BAD_CAST name, BAD_CAST uri); if (attrp == NULL) { - if (!follow_spec && xmlStrEqual(BAD_CAST uri, DOM_XMLNS_NAMESPACE)) { + if (!follow_spec && xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NS_URI)) { xmlNsPtr nsptr; nsptr = dom_get_nsdecl(elemp, BAD_CAST name); if (nsptr != NULL) { diff --git a/ext/dom/node.c b/ext/dom/node.c index 561ec8b576d..abda6cccce9 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -723,7 +723,7 @@ zend_result dom_node_prefix_write(dom_object *obj, zval *newval) if (strURI == NULL || (zend_string_equals_literal(prefix_str, "xml") && strcmp(strURI, (char *) XML_XML_NAMESPACE)) || (nodep->type == XML_ATTRIBUTE_NODE && zend_string_equals_literal(prefix_str, "xmlns") && - strcmp(strURI, (char *) DOM_XMLNS_NAMESPACE)) || + strcmp(strURI, DOM_XMLNS_NS_URI)) || (nodep->type == XML_ATTRIBUTE_NODE && !strcmp((char *) nodep->name, "xmlns"))) { php_dom_throw_error(NAMESPACE_ERR, dom_get_strict_error(obj->document)); return FAILURE; diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 450c2a55c63..711ea29d125 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -2066,8 +2066,8 @@ xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) { xmlNsPtr nsptr; if (! ((prefix && !strcmp (prefix, "xml") && strcmp(uri, (char *)XML_XML_NAMESPACE)) || - (prefix && !strcmp (prefix, "xmlns") && strcmp(uri, (char *)DOM_XMLNS_NAMESPACE)) || - (prefix && !strcmp(uri, (char *)DOM_XMLNS_NAMESPACE) && strcmp (prefix, "xmlns")))) { + (prefix && !strcmp (prefix, "xmlns") && strcmp(uri, DOM_XMLNS_NS_URI)) || + (prefix && !strcmp(uri, DOM_XMLNS_NS_URI) && strcmp (prefix, "xmlns")))) { nsptr = dom_get_ns_unchecked(nodep, uri, prefix); if (UNEXPECTED(nsptr == NULL)) { goto err; diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h index fb1760d25c3..e93767ebc84 100644 --- a/ext/dom/xml_common.h +++ b/ext/dom/xml_common.h @@ -56,9 +56,6 @@ PHP_DOM_EXPORT dom_object *php_dom_object_get_data(xmlNodePtr obj); PHP_DOM_EXPORT bool php_dom_create_object(xmlNodePtr obj, zval* return_value, dom_object *domobj); PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj); -#define DOM_XMLNS_NAMESPACE \ - (const xmlChar *) "http://www.w3.org/2000/xmlns/" - #define NODE_GET_OBJ(__ptr, __id, __prtype, __intern) { \ __intern = Z_LIBXML_NODE_P(__id); \ if (UNEXPECTED(__intern->node == NULL)) { \