|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jonathan dot poelen+php at gmail dot com
New email:
PHP Version: OS:


 [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-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 01 19:03:36 2023 UTC