Bug #73864 [Opn->Nab]: '3.' is considered as a numeric string
| From: | cmb@php.net | Date: | Fri, 06 Jan 2017 17:51:20 +0000 |
| Subject: | Bug #73864 [Opn->Nab]: '3.' is considered as a numeric string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206328@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73864&edit=1
ID: 73864
Updated by: cmb@php.net
Reported by: mumu at seznam dot cz
Summary: '3.' is considered as a numeric string
-Status: Open
+Status: Not a bug
Type: Bug
-Package: Unknown/Other Function
+Package: Scripting Engine problem
Operating System: Windows 10
PHP Version: 7.1.0
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> (has no match in real world)
Well, floating point numbers generally do not match the real
world. Anyhow, the valid syntax of float numbers is well
documented[1], so this is not a bug.
[1] <http://php.net/manual/en/language.types.float.php>
Previous Comments:
------------------------------------------------------------------------
[2017-01-06 10:43:55] mumu at seznam dot cz
I would not expect 3. to be a valid syntax of a number. However, it seems to be valid notation in
PHP. Personally, I would be happy if this syntax is not a valid number as it is quite confusing and
weird (has no match in real world).
------------------------------------------------------------------------
[2017-01-04 21:48:38] requinix@php.net
It is a valid number. Why shouldn't it be?
------------------------------------------------------------------------
[2017-01-04 21:44:17] mumu at seznam dot cz
Description:
------------
'3.' is evaluated as a numeric string even it is not a valid number.
Test script:
---------------
<?php
echo '3. ' . (is_numeric('3.') ? 'IS' : 'IS NOT') . '
numeric';
?>
Expected result:
----------------
is_numeric('3.') returns false.
Actual result:
--------------
is_numeric('3.') returns true.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73864&edit=1