#32172 [NEW]: Switch 0 Bug (first case)

From: Date: Thu, 03 Mar 2005 13:37:08 +0000
Subject: #32172 [NEW]: Switch 0 Bug (first case)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74791@lists.php.net to get a copy of this message
From: daniel dot elsner at tvi-services dot de Operating system: Linux (Fedore Core3) PHP version: 5.0.3 PHP Bug Type: Variables related Bug description: Switch 0 Bug (first case) Description: ------------ a switch on a String variable go in the first case if the Variable 0. if the variable "0" its right and he goes in default! Reproduce code: --------------- $fish = 0; switch($fish) { case "one": echo "one"; break; case "two": echo "two"; break; default: echo "default"; break; } Expected result: ---------------- default Actual result: -------------- one -- Edit bug report at http://bugs.php.net/?id=32172&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32172&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32172&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32172&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32172&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32172&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32172&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32172&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32172&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32172&r=support Expected behavior: http://bugs.php.net/fix.php?id=32172&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32172&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32172&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32172&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32172&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32172&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32172&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32172&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32172&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32172&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32172&r=mysqlcfg

« previous php.bugs (#74791) next »