From f4adaf245b182cf0ed15c1bf811d13b7f797152a Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Tue, 24 Jun 2014 20:48:03 +1000 Subject: [PATCH] Cause a scene when Twig extensions fail, instead of failing silently --- modules/cms/twig/Extension.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/cms/twig/Extension.php b/modules/cms/twig/Extension.php index 4003b50f5..768940586 100644 --- a/modules/cms/twig/Extension.php +++ b/modules/cms/twig/Extension.php @@ -10,6 +10,7 @@ use Twig_SimpleFunction; use Cms\Classes\Controller; use Cms\Classes\CmsException; use Cms\Classes\MarkupManager; +use System\Classes\ApplicationException; /** * The CMS Twig extension class implements the basic CMS Twig functions and filters. @@ -69,7 +70,7 @@ class Extension extends Twig_Extension */ foreach ($this->markupManager->listFunctions() as $name => $callable) { if (!is_callable($callable)) - continue; + throw new ApplicationException(sprintf('The markup function for %s is not callable.', $name)); $functions[] = new Twig_SimpleFunction($name, $callable, ['is_safe' => ['html']]); } @@ -95,7 +96,7 @@ class Extension extends Twig_Extension */ foreach ($this->markupManager->listFilters() as $name => $callable) { if (!is_callable($callable)) - continue; + throw new ApplicationException(sprintf('The markup filter for %s is not callable.', $name)); $filters[] = new Twig_SimpleFilter($name, $callable, ['is_safe' => ['html']]); }