Parse error: Invalid numeric literal after upgrade to laravel 5.2

Parse error: Invalid numeric literal after upgrade to laravel 5.2

我正在将 laravel 5.1 升级到 5.2。一切都运行顺利,除了我的播种机。

当我 运行 播种器时,我发现了这个错误:

admin@arrasyid:/var/www/sys_pb$ php artisan db:seed


  [Symfony\Component\Debug\Exception\FatalThrowableError]  
  Parse error: Invalid numeric literal                     

谷歌搜索错误后我找不到解决方案。请给我一个与此相关的建议。谢谢

From the PHP 7 Migration Guide in the Manual

Invalid Octal Literals

Previously, octal literals that contained invalid numbers were silently truncated (0128 was taken as 012). Now, an invalid octal literal will cause a parse error.

Changes to integer handling

所以这意味着从 PHP 7 开始,您的代码中的类似内容可能会导致 Invalid numeric literal 出现致命的解析错误,而以前在 PHP 5 中,它会被默默地忽略.

$arr = [08, 09, 10, 11]; // works in PHP 5, throws fatal error in PHP 7

参见 this 3v4l 示例。

我有同样的错误"Parse error: Invalid numeric literal"。对我来说,只要在数字中加上单引号就可以了。 像这样: $arr = ['08', '09', '10', '11']