Bug #69335 [NEW]: SplArray BC break

From: Date: Tue, 31 Mar 2015 03:52:27 +0000
Subject: Bug #69335 [NEW]: SplArray BC break
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191739@lists.php.net to get a copy of this message
From: laruence Operating system: PHP version: master-Git-2015-03-31 (snap) Package: SPL related Bug Type: Bug Bug description:SplArray BC break 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 bug report at https://bugs.php.net/bug.php?id=69335&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69335&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69335&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69335&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69335&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69335&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69335&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69335&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69335&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69335&r=support Expected behavior: https://bugs.php.net/fix.php?id=69335&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69335&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69335&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69335&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69335&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69335&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69335&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69335&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69335&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69335&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69335&r=mysqlcfg

« previous php.bugs (#191739) next »