Why doesn't lint tell me the line number and nature of the parse error?

Hammerite picture Hammerite · Jul 27, 2010 · Viewed 9.2k times · Source

I'm calling php lint from a Windows batch file, like so:

@echo off
for %%f in (*.php) do php -l %%f

When a file contains a syntax error, it only outputs Errors parsing xxx.php. Is there any way to get it to tell me what the nature of the error is, and what line it's on? Maybe another switch?

Answer

PJ Brunet picture PJ Brunet · Jan 7, 2013

If you get the "Errors parsing foo.php" message without any details, this parameter shows errors when you run PHP lint:

php -d display_errors=1 -l foo.php

Example:

[somewhere]# php -l submit.php

Errors parsing submit.php

[somewhere]# php -d display_errors=1 -l submit.php

Parse error: syntax error, unexpected T_VARIABLE in submit.php on line 226
Errors parsing submit.php