From: Operating system: OS X 10.5.8 (Irrelevant) PHP version: Irrelevant Package: Scripting Engine problem Bug Type: Bug Bug description:Unexpected behavior involving conditions.
Description: ------------ Using IF or WHILE statements (possibly others?), the code below produces unexpected results. Test script: --------------- //Set a variable with an initial value. $TEST="Initial"; //Set the variable to a different value, then test for it. if($TEST="Secondary" && $TEST==="Secondary") echo "Expected result occurred."; else echo "Expectation FAIL"; //During the ($TEST==="Secondary") condition, $TEST should match "Secondary", having just been set to "Secondary". Instead, there $TEST is actually still "Initial". echo "\n".$TEST; Expected result: ---------------- $TEST should be set to "Secondary" within the IF statement and then reflect that within said IF statement. It does not seem to. Script result: Expected result occurred. Secondary Actual result: -------------- What actually happens is that $TEST only becomes "Secondart" *after* the entire IF statement has processed. So any following comparison with $TEST still yields its initial value. Script result: Expectation FAIL Secondary -- Edit bug report at https://bugs.php.net/bug.php?id=55373&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55373&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55373&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55373&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55373&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55373&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55373&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55373&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55373&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55373&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55373&r=support Expected behavior: https://bugs.php.net/fix.php?id=55373&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55373&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55373&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55373&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55373&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55373&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55373&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55373&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55373&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55373&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55373&r=mysqlcfg