diff --git a/core/lib/Drupal/Core/Template/TwigEnvironment.php b/core/lib/Drupal/Core/Template/TwigEnvironment.php index 3c873c1..dc7de16 100644 --- a/core/lib/Drupal/Core/Template/TwigEnvironment.php +++ b/core/lib/Drupal/Core/Template/TwigEnvironment.php @@ -119,12 +119,7 @@ public function loadTemplate($name, $index = NULL) { if (!class_exists($cls, FALSE)) { $cache_filename = $this->getCacheFilename($name); - if ($cache_filename === FALSE) { - $compiled_source = $this->compileSource($this->loader->getSource($name), $name); - eval('?' . '>' . $compiled_source); - } - else { - + if ($cache_filename !== FALSE) { // If autoreload is on, check that the template has not been // modified since the last compilation. if ($this->isAutoReload() && !$this->isFresh($cache_filename, $name)) { @@ -136,6 +131,10 @@ public function loadTemplate($name, $index = NULL) { $this->storage()->load($cache_filename); } } + if (!class_exists($cls, FALSE)) { + $compiled_source = $this->compileSource($this->loader->getSource($name), $name); + eval('?' . '>' . $compiled_source); + } } if (!$this->runtimeInitialized) {