At 11:39 18-11-2002, Derick Rethans wrote:
[...]
> Or a more general command to verify PHP code
> php_valid($code_str). That way the people who expect parse errors in
> their include files can do
>
> $code_str(implode("", file("include.inc")));
> if (php_valid($code_str)) {
> include_once("include.inc");
> }
That would be hard, as the zend_compile function which runs the parse
also adds the functions, so if the code parses it includes it right
away. Again, for this one we _could_ not abort the script, but in the
case of include files I'd like to see it die hard again. eval() is
something different in a logical way, but the implementation in the zend
engine is about the same.
Since there is '-l'int in the cli, how about a lint function? At least then,
you can verify includes before including them and take any action you want,
including mail().
In a well designed application, you would be able to act on any parse error,
but the 'main' file. Of course this won't work with 'require'.
With kind regards,
Melvyn Sopacua
<?php include("not_reflecting_employers_views.txt"); ?>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php