Bug #73374 [NEW]: intval() with base 0 does not detect binary
| From: | nikic@php.net | Date: | Sat, 22 Oct 2016 21:58:10 +0000 |
| Subject: | Bug #73374 [NEW]: intval() with base 0 does not detect binary | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204969@lists.php.net to get a copy of this message | ||
From: nikic
Operating system:
PHP version: Irrelevant
Package: Math related
Bug Type: Bug
Bug description:intval() with base 0 does not detect binary
Description:
------------
intval() using base 0 currently detects decimal, octal and hexadecimal
numbers based on notation. However, binary numbers are always converted
to 0. As PHP supports binary number literals as of PHP 5.4 they should
be supported here as well.
https://3v4l.org/GYVQa
Test script:
---------------
var_dump(intval('0b1101', 0));
Expected result:
----------------
int(13)
Actual result:
--------------
int(0)
--
Edit bug report at https://bugs.php.net/bug.php?id=73374&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73374&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73374&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73374&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73374&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73374&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73374&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73374&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73374&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73374&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73374&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73374&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73374&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73374&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73374&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73374&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73374&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73374&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73374&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73374&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73374&r=mysqlcfg