Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
April 25, 2005, 1:03 am
rate this thread
I'm thinking I'll write a script that loops through all the PHP files
in a folder and does two tests, first to see if a file is there and
then to see if it can be included(). If file_exists() is true and
included() is false, there is probably a parse error in that file. I'll
then have the script spit out a warning for me.
Does anyone have a better idea than this?
Re: what is the best way to test for parse errors?
Inclusion can produce variable name collisions...
You can call the command-line interpreter with the -l key. This
option tells the interpreter not to execute the script, but only
to check its syntax.
If the script is not found, the interpreter will return:
Could not open input file: script.php.
If the script is found and syntax check is sucessful, the
interpreter will return:
No syntax errors detected in scrip.php
If the interpreter's response is something other than those
two, there's a syntax error.