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

From: Date: Wed, 05 Aug 2026 13:27:37 +0000
Subject: [php-src] PR #23068: Fix negative SimpleXML offsets aliasing the first element
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-37556@lists.php.net to get a copy of this message
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.

« previous php.git-pulls (#37556) next »