Skip to content

Commit 649394d

Browse files
committed
Remove redundant namespace define
1 parent d57e7a9 commit 649394d

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
147147
- php_dom_create_object() now no longer accepts a NULL obj argument.
148148
- Removed the `ret` argument from the DOM_RET_OBJ macro, use the return
149149
value instead.
150+
- Removed DOM_XMLNS_NAMESPACE from xml_common.h. Use DOM_XMLNS_NS_URI
151+
from namespace_compat.h instead.
150152

151153
b. ext/random
152154
- The macro RAND_RANGE_BADSCALING() has been removed. The implementation

ext/dom/element.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ static const xmlChar *dom_get_attribute_ns(dom_object *intern, xmlNodePtr elemp,
814814
*should_free_result = true;
815815
return strattr;
816816
} else {
817-
if (!follow_spec && xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NAMESPACE)) {
817+
if (!follow_spec && xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NS_URI)) {
818818
xmlNsPtr nsptr = dom_get_nsdecl(elemp, BAD_CAST name);
819819
if (nsptr != NULL) {
820820
return nsptr->href;
@@ -887,7 +887,7 @@ static void dom_set_attribute_ns_legacy(dom_object *intern, xmlNodePtr elemp, ch
887887

888888
if ((xmlStrEqual(BAD_CAST prefix, BAD_CAST "xmlns") ||
889889
(prefix == NULL && xmlStrEqual(BAD_CAST localname, BAD_CAST "xmlns"))) &&
890-
xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NAMESPACE)) {
890+
xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NS_URI)) {
891891
is_xmlns = 1;
892892
if (prefix == NULL) {
893893
nsptr = dom_get_nsdecl(elemp, NULL);
@@ -1152,7 +1152,7 @@ PHP_METHOD(DOMElement, getAttributeNodeNS)
11521152
attrp = xmlHasNsProp(elemp, BAD_CAST name, BAD_CAST uri);
11531153

11541154
if (attrp == NULL) {
1155-
if (!follow_spec && xmlStrEqual(BAD_CAST uri, DOM_XMLNS_NAMESPACE)) {
1155+
if (!follow_spec && xmlStrEqual(BAD_CAST uri, BAD_CAST DOM_XMLNS_NS_URI)) {
11561156
xmlNsPtr nsptr;
11571157
nsptr = dom_get_nsdecl(elemp, BAD_CAST name);
11581158
if (nsptr != NULL) {

ext/dom/node.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ zend_result dom_node_prefix_write(dom_object *obj, zval *newval)
723723
if (strURI == NULL ||
724724
(zend_string_equals_literal(prefix_str, "xml") && strcmp(strURI, (char *) XML_XML_NAMESPACE)) ||
725725
(nodep->type == XML_ATTRIBUTE_NODE && zend_string_equals_literal(prefix_str, "xmlns") &&
726-
strcmp(strURI, (char *) DOM_XMLNS_NAMESPACE)) ||
726+
strcmp(strURI, DOM_XMLNS_NS_URI)) ||
727727
(nodep->type == XML_ATTRIBUTE_NODE && !strcmp((char *) nodep->name, "xmlns"))) {
728728
php_dom_throw_error(NAMESPACE_ERR, dom_get_strict_error(obj->document));
729729
return FAILURE;

ext/dom/php_dom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,8 +2066,8 @@ xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) {
20662066
xmlNsPtr nsptr;
20672067

20682068
if (! ((prefix && !strcmp (prefix, "xml") && strcmp(uri, (char *)XML_XML_NAMESPACE)) ||
2069-
(prefix && !strcmp (prefix, "xmlns") && strcmp(uri, (char *)DOM_XMLNS_NAMESPACE)) ||
2070-
(prefix && !strcmp(uri, (char *)DOM_XMLNS_NAMESPACE) && strcmp (prefix, "xmlns")))) {
2069+
(prefix && !strcmp (prefix, "xmlns") && strcmp(uri, DOM_XMLNS_NS_URI)) ||
2070+
(prefix && !strcmp(uri, DOM_XMLNS_NS_URI) && strcmp (prefix, "xmlns")))) {
20712071
nsptr = dom_get_ns_unchecked(nodep, uri, prefix);
20722072
if (UNEXPECTED(nsptr == NULL)) {
20732073
goto err;

ext/dom/xml_common.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ PHP_DOM_EXPORT dom_object *php_dom_object_get_data(xmlNodePtr obj);
5656
PHP_DOM_EXPORT bool php_dom_create_object(xmlNodePtr obj, zval* return_value, dom_object *domobj);
5757
PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
5858

59-
#define DOM_XMLNS_NAMESPACE \
60-
(const xmlChar *) "http://www.w3.org/2000/xmlns/"
61-
6259
#define NODE_GET_OBJ(__ptr, __id, __prtype, __intern) { \
6360
__intern = Z_LIBXML_NODE_P(__id); \
6461
if (UNEXPECTED(__intern->node == NULL)) { \

0 commit comments

Comments
 (0)