Bug #75426 [Com]: "Cannot use empty array elements" reports wrong position
Edit report at https://bugs.php.net/bug.php?id=75426&edit=1
ID: 75426
Comment by: andrew dot nester dot dev at gmail dot com
Reported by: cweiske@php.net
Summary: "Cannot use empty array elements" reports wrong
position
Status: Open
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.2.0RC4
Block user comment: N
Private report: N
New Comment:
Thanks for pointing this issue! I've just added CR implementing this.
Previous Comments:
------------------------------------------------------------------------
[2017-10-24 12:20:15] cweiske@php.net
Description:
------------
If there is a syntax error because there are two consecutive commas in an array, a fatal error is
reported:
PHP Fatal error: Cannot use empty array elements in arrays in file.php on line 3
The problem is that the line reported is the start of the array definition, not the line at which
the error actually is.
This makes it very hard to debug array definitions of 100 lines length.
See https://3v4l.org/Ek6pJ and https://3v4l.org/WJUbZ
Test script:
---------------
<?php
$a = [
1,
,
3
];
Expected result:
----------------
Line 4 should be reported.
Actual result:
--------------
Line 3 is reported.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75426&edit=1
Thread (3 messages)