Bug #73990 [Opn->Nab]: array key leading zero inconsistent parse error

From: Date: Wed, 25 Jan 2017 10:49:46 +0000
Subject: Bug #73990 [Opn->Nab]: array key leading zero inconsistent parse error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206940@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73990&edit=1 ID: 73990 Updated by: requinix@php.net Reported by: zewy at hotmail dot com Summary: array key leading zero inconsistent parse error -Status: Open +Status: Not a bug Type: Bug Package: Compile Failure Operating System: Linux PHP Version: 7.1.1 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php A leading zero means octal, which only uses digits 0-7. In PHP 7 invalid octal numbers became a parse error. http://php.net/manual/en/language.types.integer.php https://en.wikipedia.org/wiki/Octal Previous Comments: ------------------------------------------------------------------------ [2017-01-25 10:14:02] zewy at hotmail dot com Description: ------------ array key with a leading 0 and any digit except for 8 or 9 will not result in Parse error! This have bin sens php 7.0+ Test script: --------------- $a = array(00=>'OK',01=>'OK',02=>'OK',03=>'OK',04=>'OK',05=>'OK',06=>'OK',07=>'OK',10=>'OK',18=>'OK',19=>'OK'); #$b = array(08=>'08',09=>'09',018=>'018',019=>'019'); print_r($a); Expected result: ---------------- Parse error: Invalid numeric literal in X on line Y Actual result: -------------- Array ( [0] => OK [1] => OK [2] => OK [3] => OK [4] => OK [5] => OK [6] => OK [7] => OK [10] => OK [18] => OK [19] => OK ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73990&edit=1

« previous php.bugs (#206940) next »