Bug #70193 [Com]: Invalid numeric literal
Edit report at https://bugs.php.net/bug.php?id=70193&edit=1
ID: 70193
Comment by: nospam at mckenzies dot net
Reported by: phpbugs at caspertech dot co dot uk
Summary: Invalid numeric literal
Status: Not a bug
Type: Bug
Package: Variables related
Operating System: Gentoo
PHP Version: 7.0.0beta2
Block user comment: N
Private report: N
New Comment:
This is ridiculous! Bad regression, from working to PARSE ERROR! Why not warning or deprecated???
Previous Comments:
------------------------------------------------------------------------
[2015-08-05 12:53:59] nikic@php.net
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.
------------------------------------------------------------------------
[2015-08-05 11:53:24] phpbugs at caspertech dot co dot uk
Description:
------------
In some cases, an apparently valid numeric literal is being detected as an invalid numeric literal.
This is a regression since php5.4 - http://3v4l.org/MmCot
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:
---------------
<?php
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70193&edit=1
Thread (3 messages)