Bug #63583 [Opn->Nab]: Comparing objects is wrong
| From: | aharvey@php.net | Date: | Fri, 23 Nov 2012 01:52:35 +0000 |
| Subject: | Bug #63583 [Opn->Nab]: Comparing objects is wrong | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174860@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63583&edit=1
ID: 63583
Updated by: aharvey@php.net
Reported by: vadimx at gmail dot com
Summary: Comparing objects is wrong
-Status: Open
+Status: Not a bug
Type: Bug
Package: SimpleXML related
Operating System: *
PHP Version: 5.3.18
Block user comment: N
Private report: N
New Comment:
SimpleXML does implement object comparison, but it compares both the underlying document and node
â if they aren't the same (and they aren't, in this case, since both new
SimpleXMLElement() calls create new documents and nodes), then the objects aren't the same.
Previous Comments:
------------------------------------------------------------------------
[2012-11-22 16:40:48] vadimx at gmail dot com
Description:
------------
Comparing objects always returns false. How can i compare objects?
Test script:
---------------
$xml = '<a><b/></a>';
$a = new SimpleXMLElement($xml);
$b = new SimpleXMLElement($xml);
var_dump($a == $b);
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63583&edit=1