[GIT-PULLS] [php-src] PR #23068: Fix negative SimpleXML offsets aliasing the first element

[email protected] (iliaal)
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/23068
Author: iliaal

sxe_get_element_by_offset scans with nodendx <= offset, which is already false on the first iteration for a negative offset, so it returns the node it was given. `$xml->item[-1]` therefore reports isset() true and reads the first item. Assigning to it overwrites `$xml->item[0]`. Negative offsets now miss, and writing to one warns like an out-of-range positive offset instead of creating an element.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.