mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Clarify SimpleXML comparison logic
This commit is contained in:
parent
fb5bfcb75b
commit
6bf483a94a
1 changed files with 15 additions and 7 deletions
|
@ -1291,16 +1291,24 @@ static int sxe_objects_compare(zval *object1, zval *object2) /* {{{ */
|
||||||
sxe1 = Z_SXEOBJ_P(object1);
|
sxe1 = Z_SXEOBJ_P(object1);
|
||||||
sxe2 = Z_SXEOBJ_P(object2);
|
sxe2 = Z_SXEOBJ_P(object2);
|
||||||
|
|
||||||
if (sxe1->node == NULL) {
|
if (sxe1->node != NULL && sxe2->node != NULL) {
|
||||||
if (sxe2->node) {
|
/* Both nodes set: Only support equality comparison between nodes. */
|
||||||
return 1;
|
if (sxe1->node == sxe2->node) {
|
||||||
} else if (sxe1->document->ptr == sxe2->document->ptr) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return ZEND_UNCOMPARABLE;
|
||||||
} else {
|
|
||||||
return !(sxe1->node == sxe2->node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sxe1->node == NULL && sxe2->node == NULL) {
|
||||||
|
/* Both nodes not set: Only support equality comparison between documents. */
|
||||||
|
if (sxe1->document->ptr == sxe2->document->ptr) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return ZEND_UNCOMPARABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only one of the nodes set: Cannot compare. */
|
||||||
|
return ZEND_UNCOMPARABLE;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue