Doc #64877 [NEW]: is_numeric() doesn't treat strings in binary notation as documented
| From: | cmbecker69 at gmx dot de | Date: | Sat, 18 May 2013 12:40:46 +0000 |
| Subject: | Doc #64877 [NEW]: is_numeric() doesn't treat strings in binary notation as documented | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-9857@lists.php.net to get a copy of this message | ||
From: cmbecker69 at gmx dot de
Operating system: any
PHP version: 5.4.15
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:is_numeric() doesn't treat strings in binary notation as documented
Description:
------------
In PHP 5.4.15 the definition of is_numeric() is in ext/standard/type.c
(line
300ff)[1]. The relevant function to do the check for arguments of
type string is is_numeric_string_ex() in Zend/zend_operators.h (line
109ff)[2]. Apparently special support for strings in binary as well as
octal notation is missing; only strings in decimal and hexadecimal
notation are recognized as such (strings in octal notation are treated
as being decimal).
I have filed this issue as documentation problem, but it might be
considered an
implementation bug.
[1] <http://lxr.php.net/xref/PHP_5_4/ext/standard/type.c>
[2] <http://lxr.php.net/xref/PHP_5_4/Zend/zend_operators.h>
Test script:
---------------
var_dump(is_numeric('0b1'));
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=64877&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64877&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64877&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64877&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64877&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64877&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64877&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64877&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64877&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64877&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64877&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64877&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64877&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64877&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64877&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64877&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64877&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64877&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64877&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64877&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64877&r=mysqlcfg