|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80716 bad regular expression for float format
Submitted: 2021-02-06 06:15 UTC Modified: -
From: jonathan dot poelen+php at gmail dot com Assigned:
Status: Open Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-02-06 06:15 UTC] jonathan dot poelen+php at gmail dot com
From manual page:

The bnf is:

LNUM          [0-9]+(_[0-9]+)*
DNUM          ([0-9]*(_[0-9]+)*[\.]{LNUM}) | ({LNUM}[\.][0-9]*(_[0-9]+)*)
EXPONENT_DNUM (({LNUM} | {DNUM}) [eE][+-]? {LNUM})

Unfortunately, these accept _123.45 or 123._45 as float. DNUM should be

DNUM          ({LNUM}?[\.]{LNUM}) | ({LNUM}[\.])

I think there is a missing float rule that combines DNUM and EXPONENT_DNUM.

float         {EXPONENT_DNUM} | {DNUM}

Finally, it seems strange to me to have [\.] instead of \. or [.] and the format used is not the same as on the integer page:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-23 16:36 UTC] php at yopmail dot com
If that can help: from (still same in ):

LNUM	[0-9]+(_[0-9]+)*
DNUM	({LNUM}?"."{LNUM})|({LNUM}"."{LNUM}?)


	/* snip */
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 22:01:29 2024 UTC