On Mon, 18 Nov 2002, Melvyn Sopacua wrote: > 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'.
IMO parse errors should just kill your script. It's IMO not up to the language to provide fall back mechanisms for this. If a user too stupid to use broken files it's their problem. Derick -- --------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ JDI Media Solutions --------------[ if you hold a unix shell to your ear, do you hear the c? ]- -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php