mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
Adding ignoreStrictCheck option for call_user_func_array, if throwing exception
This commit is contained in:
committed by
Fabien Potencier
parent
c9eca3508c
commit
c711d37f1d
+10
-1
@@ -446,7 +446,16 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
$this->env->getExtension('sandbox')->checkMethodAllowed($object, $method);
|
||||
}
|
||||
|
||||
$ret = call_user_func_array(array($object, $method), $arguments);
|
||||
// Some objects throw exceptions when they have __call, and the method we try
|
||||
// to call is not supported. If ignoreStrictCheck is true, we should return null.
|
||||
try {
|
||||
$ret = call_user_func_array(array($object, $method), $arguments);
|
||||
} catch (\BadMethodCallException $e) {
|
||||
if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
|
||||
return null;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
|
||||
// useful when calling a template method from a template
|
||||
// this is not supported but unfortunately heavily used in the Symfony profiler
|
||||
|
||||
Reference in New Issue
Block a user