From c66cfa1d6e8e0780bd9a1f0e202674b7a9410b78 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 18 Dec 2010 14:31:15 +0100 Subject: [PATCH] made macros callable when sandbox mode is enabled --- CHANGELOG | 1 + lib/Twig/Sandbox/SecurityPolicy.php | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index fd6450f..a5e1528 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ Backward incompatibilities: Changes: + * made macros callable when sandbox mode is enabled * added an exception when a macro uses a reserved name * the "default" filter now uses the "empty" test instead of just checking for null * added the "empty" test diff --git a/lib/Twig/Sandbox/SecurityPolicy.php b/lib/Twig/Sandbox/SecurityPolicy.php index df97cfe..523fffc 100644 --- a/lib/Twig/Sandbox/SecurityPolicy.php +++ b/lib/Twig/Sandbox/SecurityPolicy.php @@ -67,6 +67,10 @@ class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterfac public function checkMethodAllowed($obj, $method) { + if ($obj instanceof Twig_Template) { + return true; + } + $allowed = false; foreach ($this->allowedMethods as $class => $methods) { if ($obj instanceof $class) { -- 1.7.2.5