You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mixing processing instructions and element nodes gives inconsistent results in SimpleXML #12168
This is because php_sxe_iterator_fetch lets the iterator point at the first element node. That's right for SXE_ITER_ELEMENT but not for SXE_ITER_NONE, especially considering that forwards iterating from that point does not skip PIs.
EDIT: and so, this problem also occurs with comments... (https://bugs.php.net/bug.php?id=43542 looks somewhat related in that it points out a similar inconsistency wrt iterators & nodes)
I opened #24791 for this. For children(), the property table now starts at the first child instead of the first element child, so leading PIs and comments show up the same way trailing ones already did (matching (array) of the element itself). Iteration is unchanged.
Activity
ndossche commentedon Sep 10, 2023
This is because
php_sxe_iterator_fetchlets the iterator point at the first element node. That's right forSXE_ITER_ELEMENTbut not forSXE_ITER_NONE, especially considering that forwards iterating from that point does not skip PIs.EDIT: and so, this problem also occurs with comments... (https://bugs.php.net/bug.php?id=43542 looks somewhat related in that it points out a similar inconsistency wrt iterators & nodes)
Truta446 commentedon Oct 27, 2026
Fix phpGH-12168: Include leading non-element nodes in children() prop…