Bug #70635 [NEW]: an assignment operation modifies the source array

From: Date: Sun, 04 Oct 2015 11:16:54 +0000
Subject: Bug #70635 [NEW]: an assignment operation modifies the source array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196386@lists.php.net to get a copy of this message
From: roger21 at free dot fr Operating system: linux debian 7.9 (old stable) PHP version: 5.4.45 Package: Arrays related Bug Type: Bug Bug description:an assignment operation modifies the source array Description: ------------ libapache2-mod-php5 5.4.45-0+deb7u1 php.ini not modified (same bug with the cli) the problem : the assignment operation in the foreach loop from one array to another modifies the source array (it shouldn't) - it does not if the source array is passed by reference in the foreach loop (it shouldn't either in this case but it could have) the test script is long because the source array is long (147) but the code is simple and obvious i don't know if the source array matters but i guess it does, otherwise the bug would have already been found Test script: --------------- http://roger21.free.fr/test/test_colors.txt Expected result: ---------------- 145 yellow 146 yellowgreen 145 yellow 146 yellowgreen 145 yellow 146 yellowgreen Actual result: -------------- 145 yellow 146 yellowgreen 145 yellow 146 yellowgreen 145 yellow 146 yellow -- Edit bug report at https://bugs.php.net/bug.php?id=70635&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70635&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70635&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70635&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70635&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70635&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70635&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70635&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70635&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70635&r=support Expected behavior: https://bugs.php.net/fix.php?id=70635&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70635&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70635&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70635&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70635&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70635&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70635&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70635&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70635&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70635&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70635&r=mysqlcfg

« previous php.bugs (#196386) next »