#34503 [NEW]: the switch statement doesn't work correct

From: Date: Wed, 14 Sep 2005 21:35:04 +0000
Subject: #34503 [NEW]: the switch statement doesn't work correct
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85057@lists.php.net to get a copy of this message
From: phpbug at domaincommunication dot de Operating system: winXP SP1, SuSE Linux 9.1 PHP version: 4.4.0 PHP Bug Type: Scripting Engine problem Bug description: the switch statement doesn't work correct Description: ------------ the switch statement doesn't compare the number '0' with strings correct. Reproduce code: --------------- $act = 0; $var = ''; switch($act){ case "search": $var = "search"; break; case 0: case "0": case '0': case false: default: $var = "zero"; } echo $var; Expected result: ---------------- zero Actual result: -------------- search -- Edit bug report at http://bugs.php.net/?id=34503&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34503&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34503&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34503&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34503&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34503&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34503&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34503&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34503&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34503&r=support Expected behavior: http://bugs.php.net/fix.php?id=34503&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34503&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34503&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34503&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34503&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34503&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34503&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34503&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34503&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34503&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34503&r=mysqlcfg

« previous php.bugs (#85057) next »