Bug->Doc #64877 [Opn]: is_numeric() doesn't treat strings in binary notation as documented
| From: | cmbecker69 at gmx dot de | Date: | Thu, 31 Oct 2013 17:13:06 +0000 |
| Subject: | Bug->Doc #64877 [Opn]: is_numeric() doesn't treat strings in binary notation as documented | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10572@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64877&edit=1
ID: 64877
User updated by: cmbecker69 at gmx dot de
Reported by: cmbecker69 at gmx dot de
Summary: is_numeric() doesn't treat strings in binary
notation as documented
Status: Open
-Type: Bug
+Type: Documentation Problem
-Package: Scripting Engine problem
+Package: Documentation problem
Operating System: any
PHP Version: 5.4.0 and later
Block user comment: N
Private report: N
New Comment:
| General consensus is that we would rather remove hex
| support than add support for binary and octal.
Then it is a documentation problem.
Previous Comments:
------------------------------------------------------------------------
[2013-10-31 16:49:26] nikic@php.net
Related discussion for is_numeric_string: http://markmail.org/message/ax2drcb6dolr5agl.
General consensus is that we would rather remove hex support than add support for binary and octal.
------------------------------------------------------------------------
[2013-10-31 16:43:09] cmbecker69 at gmx dot de
| This is bugged also for hex numbers:
The results are as expected according to the documentation. Note,
that a hexadecimal number is only reported as being numeric, if it
is in hexadecimal string notation (i.e. starting with 0x). The first
example is correctly reported as being numeric, because the "e" is
recognized as starting the exponential part of the number.
------------------------------------------------------------------------
[2013-10-31 16:08:45] daniele dot didomizio at eurac dot edu
This is bugged also for hex numbers:
print "526e948280122 " .(is_numeric("526e948280122") ? "numeric" :
"not numeric"). PHP_EOL;
print "526a948280122 ". (is_numeric("526a948280122") ? "numeric" :
"not numeric"). PHP_EOL;
print "0x526a948280122 ". (is_numeric("0x526a948280122") ? "numeric" :
"not numeric"). PHP_EOL;
print "526f948280122 ". (is_numeric("526f948280122") ? "numeric" :
"not numeric"). PHP_EOL;
output is:
526e948280122 numeric
526a948280122 not numeric
0x526a948280122 numeric
526f948280122 not numeric
tested with versions 5.5.4-1 and 5.4.4 (Debian version 5.4.4-14+deb7u5)
------------------------------------------------------------------------
[2013-08-18 04:01:08] yohgaki@php.net
> is_numeric()/intval() (many others) were not taken into account new format.
is_numeric()/intval() (may be others) were not taken into account new format.
------------------------------------------------------------------------
[2013-08-18 03:46:48] yohgaki@php.net
This problem was introduced when binary format integer was supported.
is_numeric()/intval() (many others) were not taken into account new format.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64877
--
Edit this bug report at https://bugs.php.net/bug.php?id=64877&edit=1