Bug #69335 [Sus]: SplArray BC break

From: Date: Tue, 12 Sep 2017 14:29:47 +0000
Subject: Bug #69335 [Sus]: SplArray BC break
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211098@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69335&edit=1 ID: 69335 Updated by: cmb@php.net Reported by: laruence@php.net Summary: SplArray BC break Status: Suspended Type: Bug Package: SPL related PHP Version: master-Git-2015-03-31 (snap) Assigned To: laruence Block user comment: N Private report: N New Comment: This issue appears to have been fixed, see <https://3v4l.org/vP95o>. Previous Comments: ------------------------------------------------------------------------ [2015-04-01 03:23:45] laruence@php.net marked as suspend for now ------------------------------------------------------------------------ [2015-03-31 03:52:27] laruence@php.net Description: ------------ with the new Hashtable implementation.. follows script doesn't works as before: anyway, I don't see a good way to fix it (using HashTableIterator is expensive here, and may introduce performance issue for later foreach calls) I'd like add a test script, and mark it as XFAIL, linked to this entry. Test script: --------------- <?php $a = array(1=>1, 3=>3, 5=>5, 7=>7); $a = new ArrayObject($a); foreach ($a as $k => $v) { var_dump("$k => $v"); if ($k == 3) { $a['a'] = "?"; } } ?> Expected result: ---------------- string(6) "1 => 1" string(6) "3 => 3" string(6) "5 => 5" string(6) "7 => 7" string(6) "a => ?" Actual result: -------------- string(6) "1 => 1" string(6) "3 => 3" PHP Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in /tmp/1.php on line 5 Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in /tmp/1.php on line 5 string(6) "1 => 1" string(6) "3 => 3" string(6) "5 => 5" string(6) "7 => 7" string(6) "a => ?" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69335&edit=1

« previous php.bugs (#211098) next »