public function compile($compiler) { $compiler->addDebugInfo($this)->write('if ($this->env->hasExtension(\'sandbox\') && is_object(')->subcompile($this->expr)->raw(')) {' . "\n")->indent()->write('$this->env->getExtension(\'sandbox\')->checkMethodAllowed(')->subcompile($this->expr)->raw(', \'__toString\');' . "\n")->outdent()->write('}' . "\n"); parent::compile($compiler); }
/** * Compiles the node to PHP. * * @param Twig_Compiler A Twig_Compiler instance */ public function compile(Twig_Compiler $compiler) { $compiler->addDebugInfo($this)->write('if (is_object(')->raw('$_tmp = ')->subcompile($this->removeNodeFilter($this->getNode('expr')))->raw(')) {' . "\n")->indent()->write('$this->env->getExtension(\'sandbox\')->checkMethodAllowed(')->raw('$_tmp, \'__toString\');' . "\n")->outdent()->write('}' . "\n"); parent::compile($compiler); }