} elseif ($this->getNode('node') instanceof Twig_Node_Expression_GetAttr) {
$this->getNode('node')->setAttribute('is_defined_test', true);
$compiler
- ->raw('null !== ')
+ ->raw('(null !== ')
->subcompile($this->getNode('node'))
+ ->raw(')')
;
} else {
throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine());
{{ foobar is not defined ? 'ok' : 'ko' }}
{{ zero is defined ? 'ok' : 'ko' }}
{{ nested.foo is defined ? 'ok' : 'ko' }}
+{{ nested.foo is not defined ? 'ok' : 'ko' }}
{{ nested.bar is not defined ? 'ok' : 'ko' }}
{{ nested.zero is defined ? 'ok' : 'ko' }}
--DATA--
ok
ok
ok
+ko
ok
ok