diff --git a/core/lib/Drupal/Core/Template/TwigEnvironment.php b/core/lib/Drupal/Core/Template/TwigEnvironment.php index 91df9fbafb..b97da21d4c 100644 --- a/core/lib/Drupal/Core/Template/TwigEnvironment.php +++ b/core/lib/Drupal/Core/Template/TwigEnvironment.php @@ -45,6 +45,10 @@ class TwigEnvironment extends \Twig_Environment { * The options for the Twig environment. */ public function __construct($root, CacheBackendInterface $cache, $twig_extension_hash, StateInterface $state, \Twig_LoaderInterface $loader = NULL, array $options = array()) { + // Ensure that twig.engine is loaded, given that it is needed to render a + // template because functions like TwigExtension::escapeFilter() are called. + require_once $root . '/core/themes/engines/twig/twig.engine'; + $this->templateClasses = array(); $options += array(