Skip to content

Commit

Permalink
Check if legacy engine is set before calling it (ezsystems#159)
Browse files Browse the repository at this point in the history
On PHP 7.3, `loadTemplate` method is somehow called before `setEzLegacyEngine` had a chance to set the legacy engine to the `Environment` class. Checking for `null` on `$this->legacyEngine` does the job apparently, with no side-effects.
  • Loading branch information
emodric authored and andrerom committed Sep 10, 2018
1 parent dacc923 commit 557efba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mvc/Templating/Twig/Environment.php
Expand Up @@ -38,7 +38,7 @@ public function loadTemplate($name, $index = null)
return $this->legacyTemplatesCache[$name];
}

if (is_string($name) && $this->legacyEngine->supports($name)) {
if (is_string($name) && $this->legacyEngine !== null && $this->legacyEngine->supports($name)) {
if (!$this->legacyEngine->exists($name)) {
throw new Twig_Error_Loader("Unable to find the template \"$name\"");
}
Expand Down

0 comments on commit 557efba

Please sign in to comment.