From:             
Operating system: Ubuntu Linux 10.10
PHP version:      Irrelevant
Package:          Variables related
Bug Type:         Bug
Bug description:is_bool provides wrong result when running inside a switch

Description:
------------
Whenever testing for a variable with the value false using is_bool inside a
switch statement will return false instead of true.



I have tested it with different php versions, it happened on all of them.



Test script:
---------------
echo phpversion();

$var = false;

switch ($var) {

    case is_bool($var):

        echo "boolean";

        break;

    case is_numeric($var):

        echo "number";

        break;

}

if (is_bool($var))

    echo "boolean";

elseif (is_numeric($var))

    echo "number";

Expected result:
----------------
5.3.4booleanboolean

Actual result:
--------------
5.3.4numberboolean

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54592&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54592&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54592&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54592&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54592&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54592&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54592&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54592&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54592&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54592&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54592&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54592&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54592&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54592&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54592&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54592&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54592&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54592&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54592&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54592&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54592&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54592&r=mysqlcfg

Reply via email to