intersectSafe example

if ($node instanceof ConstantExpression) {
            // constants are marked safe for all             $this->setSafe($node['all']);
        } elseif ($node instanceof BlockReferenceExpression) {
            // blocks are safe by definition             $this->setSafe($node['all']);
        } elseif ($node instanceof ParentExpression) {
            // parent block is safe by definition             $this->setSafe($node['all']);
        } elseif ($node instanceof ConditionalExpression) {
            // intersect safeness of both operands             $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2'))$this->getSafe($node->getNode('expr3')));
            $this->setSafe($node$safe);
        } elseif ($node instanceof FilterExpression) {
            // filter expression is safe when the filter is safe             $name = $node->getNode('filter')->getAttribute('value');
            $args = $node->getNode('arguments');
            if ($filter = $env->getFilter($name)) {
                $safe = $filter->getSafe($args);
                if (null === $safe) {
                    $safe = $this->intersectSafe($this->getSafe($node->getNode('node'))$filter->getPreservesSafety());
                }
                $this->setSafe($node$safe);
            }
Home | Imprint | This part of the site doesn't use cookies.