View Single Post

  #2 (permalink)  
Old 05-08-2008
Rik Wasmus
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

Gilles Ganault wrote:
> Is there a tool on Linux/FreeBSD that can parse a PHP script to make
> sure there's no compile-time issues?
>
> I just noticed that I copy/pasted some code that had lines longer that
> can fit in the SSH terminal window, and that caused a run-time error
> as reported in the /var/log/httpd-error.log but not in the browser:
>
> [error] PHP Notice: Undefined index: etablissemen\nt in
> /usr/local/www/apache22/data/prospect.php on line 49, referer:
> http://server/myscript.php


You can run 'php -l thescript.php' to do a syntax check, however your
error would not be catched by that: this is a run time error, and only
catchable by actually running the script.

Of course, on live websites error should not be shown, but logged, as is
done her apparently.
--
Rik Wasmus
Reply With Quote