[development] PHP input format -> syntax checking

Robert Wohleb rob at techsanctuary.com
Mon Aug 21 14:30:55 UTC 2006


As long as the submitted code does not cause a fatal error, you should
be able to eval the code with drupal_eval and catch any errors with a
custom error handler. The trick will be in writing the error handler.



Tadej Baša wrote:
> Hi,
> as you know, there is no way to recover from syntax errors in PHP code
> a  user submits (either as nodes or for example in custom block
> visibility settings). I'm trying to figure out, if it would be
> possible to send the code to drupal_eval with javascript and prevent
> form submission if an error is returned.
> What do you think?
> -Tadej

It is by Caffeine alone that I set my mind in motion
It is by the beans of Java, that my thoughts acquire speed
The hands acquire shakes; the shakes become a warning 
It is by Caffeine alone that I set my mind in motion

More information about the development mailing list