|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70193 Invalid numeric literal
Submitted: 2015-08-05 11:53 UTC Modified: 2015-08-05 12:53 UTC
From: phpbugs at caspertech dot co dot uk Assigned:
Status: Not a bug Package: Variables related
PHP Version: 7.0.0beta2 OS: Gentoo
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: phpbugs at caspertech dot co dot uk
New email:
PHP Version: OS:


 [2015-08-05 11:53 UTC] phpbugs at caspertech dot co dot uk
In some cases, an apparently valid numeric literal is being detected as an invalid numeric literal.

This is a regression since php5.4 -

It can be fixed by changing the array to:

1, 3, 5, 7, 8, 10, 12

However, I believe this is possibly unintended behaviour (is there any reason not to accept prefixed zeros?)

Test script:

class Test
    protected static $months_31 = array( 01, 03, 05, 07, 08, 10, 12 );


Expected result:
No output - I would expect these numeric literals to parse without incident.

Actual result:
Parse error: Invalid numeric literal in /test.php on line 5


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-05 12:53 UTC]
-Status: Open +Status: Not a bug
 [2015-08-05 12:53 UTC]
Numbers starting with 0 are octal literals. 08 is not a valid octal literal, so you get an error now. Previously it was silently treated like 0.
 [2019-12-12 15:57 UTC] nospam at mckenzies dot net
This is ridiculous!  Bad regression, from working to PARSE ERROR!  Why not warning or deprecated???
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 04:01:29 2024 UTC