[php-src] Issue #7740: Access behavior of SimpleXMLElement changes when element has sibling
| From: | noreply@php.net | Date: | Wed, 08 Dec 2021 19:12:38 +0000 |
| Subject: | [php-src] Issue #7740: Access behavior of SimpleXMLElement changes when element has sibling | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238288@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7740
Comment Author: damianwadley
Note that
$bar is not actually an array but a SimpleXMLElement object that, when
dumped, makes it look like it could contain multiple pieces of data. ->bar will
always behave as a single instance (except in dumps) and ->bar[0] will always access
the first "bar" element, and both are regardless of whether there is only one value or
there are multiple for that name.
https://3v4l.org/n8sJH
Is there a particular issue in code you're encountering because of this, or is it just that the
output is surprising (and arguably inaccurate)?