Remove redundant namespace define

This commit is contained in:
Niels Dossche 2024-03-09 17:34:44 +01:00
parent d57e7a920b
commit 649394d357
5 changed files with 8 additions and 9 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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)) { \