Bug #71073 [NEW]: Foreach behaviour changes allow for infinite loops

From: Date: Wed, 09 Dec 2015 09:42:59 +0000
Subject: Bug #71073 [NEW]: Foreach behaviour changes allow for infinite loops
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197726@lists.php.net to get a copy of this message
From: ljsteadman at gmail dot com Operating system: Any PHP version: 7.0.0 Package: Performance problem Bug Type: Bug Bug description:Foreach behaviour changes allow for infinite loops Description: ------------ The latest behaviour changes to foreach means that if an element is pushed onto the array during iteration with a unique key, it will infinite loop. Test script: --------------- https://3v4l.org/ATFK9 Expected result: ---------------- foreach shouldn't produce a infinite loop. Actual result: -------------- foreach continues to iterate until it runs out of memory, thus producing an infinite loop. -- Edit bug report at https://bugs.php.net/bug.php?id=71073&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71073&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71073&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71073&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71073&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71073&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71073&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71073&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71073&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71073&r=support Expected behavior: https://bugs.php.net/fix.php?id=71073&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71073&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71073&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71073&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71073&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71073&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71073&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71073&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71073&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71073&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71073&r=mysqlcfg

« previous php.bugs (#197726) next »