#32172 [Opn->Bgs]: Switch 0 Bug (first case)
| From: | johannes@php.net | Date: | Thu, 03 Mar 2005 14:52:57 +0000 |
| Subject: | #32172 [Opn->Bgs]: Switch 0 Bug (first case) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-77034@lists.php.net to get a copy of this message | ||
ID: 32172
Updated by: johannes@php.net
Reported By: daniel dot elsner at tvi-services dot de
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Linux (Fedore Core3)
PHP Version: 5.0.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
If an integer is compared with a string the string is
converted to an integer.
http://de.php.net/manual/en/types.comparisons.php
Previous Comments:
------------------------------------------------------------------------
[2005-03-03 15:05:31] KRomas at goldentele dot com
bogus, not a bag
var_dump(0=='one');
var_dump(0==='one');
------------------------------------------------------------------------
[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