Handling of PHP errors in Twig templates is more graceful

This is achieved by temporarily registering a custom error handler and
converting all errors into exceptions. The exception is then simply
treated as a validation error instead of a language error.