Preserve array internal pointer during copy-on-write separation - #23620
Preserve array internal pointer during copy-on-write separation#23620darkdi wants to merge 1 commit into
Conversation
Signed-off-by: Dmitry Rantovov <rantovov5@gmail.com>
|
Hi @darkdi thanks for the patch but I m afraid the fix is really incorrect, I ll let ilaal review tough. |
|
Direction looks right: matching the immutable path lines up with the The And it is incomplete for mixed arrays with holes, where
Setting The |
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 makeskey()andcurrent()observe the first element, even though the source array was already past the end.The immutable duplication path preserves
nInternalPointerverbatim. 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 --checkpasses; a full source build is not available in this environment.Fixes GH-23617.