Posted by Hilarion on 07/11/05 13:01
Cristian Gutierrez wrote:
> Is there any way to trigger "undefined variable/constant" error notices
> when running `php -l' over a source file? Or even better, when using
> php_check_syntax() over the file?
AFAIK no.
> So far I've noticed that I only get those errors when actually *running*
> the script, and I'm beggining to suspect there's little more (if at all)
> to do without getting dirty with a PHP language parser. For example,
> when I run the following script:
> [...]
Those notice messages are only available on runtime cause only
then one can check for sure if some variable was set (or some constant
was defined). Those notices have nothing to do with syntax.
For example your "testerr.php" script could be included by other
script which would (prior to including) set value of variable $a and
define constant "a", so there would be no notices.
Hilarion
[Back to original message]
|