* 0.9.8
+ * removed Twig_Template instances from the debug tag output
* fixed objects with __isset() defined
* fixed set tag when used with a capture
* fixed type hinting for Twig_Environment::addFilter() method
$compiler
->write("if (\$this->env->isDebug()) {\n")
->indent()
- ->write('var_export(')
;
if (null === $this->expr) {
- $compiler->raw('$context');
+ // remove embedded templates (macros) from the context
+ $compiler
+ ->write("\$vars = array();\n")
+ ->write("foreach (\$context as \$key => \$value) {\n")
+ ->indent()
+ ->write("if (!\$value instanceof Twig_Template) {\n")
+ ->indent()
+ ->write("\$vars[\$key] = \$value;\n")
+ ->outdent()
+ ->write("}\n")
+ ->outdent()
+ ->write("}\n")
+ ->write("print_r(\$vars);\n")
+ ;
} else {
- $compiler->subcompile($this->expr);
+ $compiler
+ ->write("print_r(")
+ ->subcompile($this->expr)
+ ->raw(");\n")
+ ;
}
$compiler
- ->raw(");\n")
->outdent()
->write("}\n")
;
$tests[] = array(new Twig_Node_Debug(null, 0), <<<EOF
if (\$this->env->isDebug()) {
- var_export(\$context);
+ \$vars = array();
+ foreach (\$context as \$key => \$value) {
+ if (!\$value instanceof Twig_Template) {
+ \$vars[\$key] = \$value;
+ }
+ }
+ print_r(\$vars);
}
EOF
);
$tests[] = array($node, <<<EOF
if (\$this->env->isDebug()) {
- var_export((isset(\$context['foo']) ? \$context['foo'] : null));
+ print_r((isset(\$context['foo']) ? \$context['foo'] : null));
}
EOF
);