#43846 [Opn->Bgs]: Switch statement broken when using 'null' value
| From: | bjori@php.net | Date: | Mon, 14 Jan 2008 21:30:30 +0000 |
| Subject: | #43846 [Opn->Bgs]: Switch statement broken when using 'null' value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121278@lists.php.net to get a copy of this message | ||
ID: 43846
Updated by: bjori@php.net
Reported By: php_bug at jldupont dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.2.5
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
.
Previous Comments:
------------------------------------------------------------------------
[2008-01-14 21:21:36] php_bug at jldupont dot com
Description:
------------
The 'switch' statement does not correctly handle the case where the
switch value === null.
Reproduce code:
---------------
The following code should show "null", "true", "false":
function testSwitch( $v )
{
return $v;
}
function showResult( $r )
{
$v = testSwitch( $r );
switch ($v)
{
case false:
echo "false";
break;
case null:
echo "null";
break;
case true:
echo "true";
break;
}
echo "\n<br/>";
}
showResult( null );
showResult( true );
showResult( false );
Expected result:
----------------
null
true
false
Actual result:
--------------
false
true
false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43846&edit=1