php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32943 is_numeric validates "3e0"
Submitted: 2005-05-04 12:28 UTC Modified: 2005-09-20 14:31 UTC
From: pmorgan at ukds dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2005-05-04 12:28 UTC] pmorgan at ukds dot net
Description:
------------
With some server side validation I inadvertenly entered "3e0" into the textbox, it validated to my suprise. Would have expected this to throw a false

Reproduce code:
---------------
echo is_numeric('3e00')? 'true': 'false';

Expected result:
----------------
false;
In fact anything without 0-9 and a . I would expect a false !


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-04 14:40 UTC] pmorgan at ukds dot net
That needs to go into the manual "number in e-notation", which I understand, or even better as an additional flag "allow_e-notation". 

It's the last error I would have expected and is very misleading AFAIK.
 [2005-09-08 13:21 UTC] betz@php.net
reopen this as documentation bug.
"number" could also be given in e-notation, hex-notation, octal-notation  
 [2005-09-20 14:31 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"Numeric strings consist of optional sign, any number of digits, optional decimal part and optional exponential part. Thus +0123.45e6 is a valid numeric value. Hexadecimal notation (0xFF) is allowed too but only without sign, decimal and exponential part."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 18:01:32 2024 UTC