[php-src] Issue #12171: SimpleXML element comparison is broken

From: Date: Sun, 10 Sep 2023 22:14:37 +0000
Subject: [php-src] Issue #12171: SimpleXML element comparison is broken
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245380@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12171 Author: nielsdos ### Description The following code: ```php <?php $xml = "<root><first/><second/><third/></root>"; $xml = simplexml_load_string($xml); var_dump($xml->first == $xml->second); ``` Resulted in this output: ``` bool(true) ``` But I expected this output instead: ``` bool(false) ``` It's because the wrong node is fetched, i.e. it doesn't take into account the iterating nature of the simple xml objects. PoC fix patch: https://gist.github.com/nielsdos/f8e232836d72e68c5d3418116ddad877 ### PHP Version PHP 5.0.0-master ### Operating System Linux

« previous php.bugs (#245380) next »