|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-08-27 09:16 UTC] [email protected]
-Status: Open
+Status: Verified
[2018-08-27 09:16 UTC] [email protected]
[2018-08-27 11:39 UTC] [email protected]
-Assigned To:
+Assigned To: dmitry
[2018-08-27 11:39 UTC] [email protected]
[2018-09-14 07:33 UTC] [email protected]
[2018-09-14 07:33 UTC] [email protected]
-Status: Verified
+Status: Closed
[2022-08-06 07:44 UTC] rkciviljungle at gmail dot com
[2022-08-06 07:50 UTC] rathod261190 at gmail dot com
[2022-08-06 07:50 UTC] [email protected]
-Block user comment: No
+Block user comment: Yes
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Mar 17 10:00:01 2026 UTC |
Description: ------------ Hey. I encountered a weird inconsistency in foreach() behavior over plain arrays. See the code below. In certain specific cases loop will skip second iteration with no apparent reason. It reproduces (at least) on 7.2.7-7.2.9 on both windows and linux, but NOT on 7.1.21 or below. Test script: --------------- $arr = [1 => 1, 3 => 3]; // [1 => 1, 2 => 3] will print both keys foreach($arr as $key => &$val) { // without & will print both keys echo "See key {$key}\n"; $arr[0] = 0; // without this line will print both keys unset($arr[0]); } Expected result: ---------------- See key 1 See key 3 Actual result: -------------- See key 1