$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