From:             
Operating system: ALL
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Bug
Bug description:is_numeric returns FALSE for chr(0) and CHR(1) that are BIT, so 
NUMERIC.

Description:
------------
I think that is_numeric should return TRUE if you pass chr(0) or chr(1) to
it because this chars are stored in database as BITs, that are numeric in
the binary context. Would php adopt it ?
I had to use a strange conditional because of this supposed "bug":
[code]
if( is_numeric($myvar) || ord($myvar) < 2) { 
  # to check char 0 or 1 that are BITS, binary numeric.
}
[/code]

Test script:
---------------
if( is_numeric( chr(0)) || is_numeric(chr(1)) )
    echo "is_numeric is great!";
 else
    echo "is_numeric might be a little buggy";

Expected result:
----------------
is_numeric shoud recognize chr(0) and chr(1) as numeric, as they are chars
for bit information.

Actual result:
--------------
is_numeric says chr(0) and chr(1) are both NOT numeric.

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

Reply via email to