Uh oh!
There was an error while loading. Please reload this page.
Stale array iterator pointer - #19616
Conversation
bwoebi
left a comment
There was a problem hiding this comment.
Looks good to me, thanks for fixing!
dstogov
left a comment
There was a problem hiding this comment.
The fix looks right, but I don't completely understand why zend_array_dup() duplicates the iterator (I forgot).
@iluuu1994, @bwoebi could you please revisit cd53ce8
@dstogov Bob can correct me if I'm wrong.
Before cd53ce8, a CoW separation would also reset the iterator for the same reason: When the iterated array is stored in a temporary variable, and then the iterated array is appended to, the array will separate and thus the The "obvious" solution would be to update the $a = range(1, 3);
$b = $a;
foreach ($aas &$x) {
foreach ($bas &$y) {
echo"$x.$y\n";
if ($x === 3 && $y === 1) {
$a[] = 4; // <-- here
}
}
}On modification of Unfortunately, I can't think of a simpler solution either. |
iluuu1994
commented
Sep 3, 2025
I'll merge this for now, this fix is needed anyway. |
FixesGH-19613