php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72839 is_numeric returns false for hex strings
Submitted: 2016-08-15 08:32 UTC Modified: 2016-08-15 10:58 UTC
From: Alexander dot Blum at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 7.1Git-2016-08-15 (Git) OS: Ubuntu 16.04
Private report: No CVE-ID: None
 [2016-08-15 08:32 UTC] Alexander dot Blum at gmail dot com
Description:
------------
With PHP7 is_numeric reports false when passing hexadecimal strings, it worked fine in PHP5

Test script:
---------------
var_dump (is_numeric ("0x111"))

Expected result:
----------------
bool(true)


Actual result:
--------------
bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-15 08:46 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2016-08-15 09:08 UTC] Alexander dot Blum at gmail dot com
Well, then the documentation needs a bugfix: https://secure.php.net/manual/de/function.is-numeric.php
 [2016-08-15 10:42 UTC] requinix@php.net
Translations affected: pt_BR, DE, KR, RU, ES, TR
FR, JA, RO are already fixed. ZH is not affected because it only says "if var is numeric then true otherwise false".

Since this affects multiple translations I'm going to make multiple bug reports for them.
 [2016-08-15 10:58 UTC] requinix@php.net
...it occurs to me that all these new bugs will be about removing text, so even a non-speaker could fix them all. Oh well.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 20:01:31 2024 UTC