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?
A parse error is an error message you sometimes get on Android devices when an app fails to install. The message itself is not very specific, and there are a lot of problems that can cause it.
No error occurs if a symbol in the LINT library has the same name as a symbol in the source file; the source file symbol is the one that is used. Functions should only be placed in a LINT library when you are sure they contain no errors.
This message comes up when trying to write inline functions without giving the function a name. Lint is set to avoid anonymous functions because giving names is more readable. Here is an example;
When LINT creates a Summary file, LINT only summarizes your source code and checks for syntax errors. It does not check for such problems as non-portable constructs or type mismatches. However, you can run a summary file through LINT again to do standard type-checking.
This one can happen easily making a mistake and using the wrong event type. It won’t create a compile-time error, but lint will find the error or properties won’t be available.
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
I've accepted Charles's answer, but thought I should add a couple of details, as I had to do some extra hunting to find out what to do.
The problem was that I wasn't seeing the stderr
output, so I started by adding 2>&1
to the end of the relevant commands. This still didn't help, so I realised that the problem was that PHP wasn't outputting stderr stuff at all. I went to the PHP install directory and looked in php.ini and found that by default, display_errors
is Off
. Changed it to On
and it now works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With