Browse code

fixed bad merge

Fabien Potencier authored on 16/04/2019 15:49:34
Showing 1 changed files
... ...
@@ -427,19 +427,7 @@ class Environment
427 427
         // to be removed in 3.0
428 428
         $this->extensionSet->initRuntime($this);
429 429
 
430
-        if (isset($this->loading[$cls])) {
431
-            throw new RuntimeError(sprintf('Circular reference detected for Twig template "%s", path: %s.', $name, implode(' -> ', array_merge($this->loading, [$name]))));
432
-        }
433
-
434
-        $this->loading[$cls] = $name;
435
-
436
-        try {
437
-            $this->loadedTemplates[$cls] = new $cls($this);
438
-        } finally {
439
-            unset($this->loading[$cls]);
440
-        }
441
-
442
-        return $this->loadedTemplates[$cls];
430
+        return $this->loadedTemplates[$cls] = new $cls($this);
443 431
     }
444 432
 
445 433
     /**