I'm working with Twig templates, and often see messages like this in the browser when I make a mistake:

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Twig\Error\SyntaxError</em>: Unclosed &quot;{&quot;. in <em class="placeholder">Twig\Lexer-&gt;lexExpression()</em> (line <em class="placeholder">153</em> of <em class="placeholder">themes/mytheme/templates/page.html.twig</em>). <pre class="backtrace">Twig\Lexer-&gt;lexBlock() (Line: 126)
Twig\Lexer-&gt;tokenize(Object) (Line: 705)


Is there a way to automatically render the above HTML rather than having it output as a string? Thanks.

  • Are you creating that message, or is this a message the system or a contributed module is creating? – Jaypan Dec 8 '19 at 1:28
  • @Jaypan I'm editing Twig templates inside my custom theme. I believe this is a PHP message is emitted by Drupal core. – apostl3pol Dec 8 '19 at 1:41
  • Ok, sorry I don’t have an answer then. – Jaypan Dec 8 '19 at 1:44
  • I say embrace the error as is then fix your mistake :) – taggartJ Dec 8 '19 at 22:20
  • 1
    This is fixed in Drupal 8.8.0, see drupal.org/project/drupal/issues/2924860 – 4k4 Dec 8 '19 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.