Bug #77010 [Opn]: is_numeric returns false for numeric strings
Edit report at https://bugs.php.net/bug.php?id=77010&edit=1
ID: 77010
Updated by: requinix@php.net
Reported by: carusogabriel@php.net
Summary: is_numeric returns false for numeric strings
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
"2.14.0-DEV" doesn't look like any number I've seen before.
So... what, if it starts with a digit then it's numeric? Should "1a" be numeric?
Previous Comments:
------------------------------------------------------------------------
[2018-10-13 20:46:22] carusogabriel@php.net
Description:
------------
As discussed in https://github.com/phpstan/phpstan/issues/1497,
there're some strings containing castable integers, for example: https://3v4l.org/Ogral, that reports as false when passing it to
is_numeric.
I'm opening this bug ticket to discuss if we need to consider this a bug and target all active
branches, or consider as a Feature Request and propose this as a new feature to the next minor
version of PHP.
Test script:
---------------
<?php
var_dump(is_numeric('2.14.0-DEV'));
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77010&edit=1
Thread (7 messages)