[php-src] PR #23620: Preserve array internal pointer during copy-on-write separation
| From: | darkdi | Date: | Tue, 08 Sep 2026 18:14:57 +0000 |
| Subject: | [php-src] PR #23620: Preserve array internal pointer during copy-on-write separation | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38391@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23620
Author: darkdi
Fix array internal pointer reset during copy-on-write separation
When an array's internal pointer is past the last element,
zend_array_dup()
currently clamps it to zero for packed and mixed arrays. A subsequent write that separates a copy
therefore makes key() and current() observe the first element, even though
the source array was already past the end.
The immutable duplication path preserves nInternalPointer verbatim. Keep the same
behavior in the packed and mixed mutable paths. Add a PHPT covering both representations.
The test reproduces the issue on the current PHP binary before the fix. git diff
--check passes; a full source build is not available in this environment.
Fixes GH-23617.