#32172 [Com]: Switch 0 Bug (first case)
| From: | KRomas at goldentele dot com | Date: | Thu, 03 Mar 2005 14:05:31 +0000 |
| Subject: | #32172 [Com]: Switch 0 Bug (first case) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-77313@lists.php.net to get a copy of this message | ||
ID: 32172
Comment by: KRomas at goldentele dot com
Reported By: daniel dot elsner at tvi-services dot de
Status: Open
Bug Type: Variables related
Operating System: Linux (Fedore Core3)
PHP Version: 5.0.3
New Comment:
bogus, not a bag
var_dump(0=='one');
var_dump(0==='one');
Previous Comments:
------------------------------------------------------------------------
[2005-03-03 14:37:08] daniel dot elsner at tvi-services dot de
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 this bug report at http://bugs.php.net/?id=32172&edit=1