Bug #70193 [Opn->Nab]: Invalid numeric literal

From: Date: Wed, 05 Aug 2015 12:54:07 +0000
Subject: Bug #70193 [Opn->Nab]: Invalid numeric literal
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194966@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70193&edit=1

 ID:                 70193
 Updated by:         nikic@php.net
 Reported by:        phpbugs at caspertech dot co dot uk
 Summary:            Invalid numeric literal
-Status:             Open
+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:

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.


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#194966) next »