Twig reset function returns blank screen

I am using the Twig dump function in Symfony2. I configured Symfony according to its instructions .

I have a variable pageand an array orders. dumpworks on the page, but is not ordered. When I call on order, I get a white screen - no php errors and nothing. I do not know how to debug this.

Any ideas?

+5
source share
4 answers

Little explanation

() PHP: . : twig var_dump , VarDumper.

, , VarDumper , twig dump(), symfony VarDumper, , .

, VarDumper dump() native var_dump() ( VarDumper ). VarDumper dump() - , / .

  • VarDumper,
  • : vendor/twig/twig/lib/Twig/Extension/Debug.php
  • twig_var_dump
  • var_dump() dump()
  • / ob_start() + ob_get_clean() ( var_dump(), , dump() )

+ , ;)

function twig_var_dump(Twig_Environment $env, $context)
{
    if (!$env->isDebug()) {
        return;
    }

//    ob_start();

    $count = func_num_args();
    if (2 === $count) {
        $vars = array();
        foreach ($context as $key => $value) {
            if (!$value instanceof Twig_Template) {
                $vars[$key] = $value;
            }
        }

        dump($vars);
    } else {
        for ($i = 2; $i < $count; $i++) {
            dump(func_get_arg($i));
        }
    }

//    return ob_get_clean();
}

PS: 2013 , , , .

:

"symfony/symfony": "2.5.*"
"symfony/var-dumper": "~2.6"
+6

, memory_limit 1Gb .

    {{ dump() }} 

( . : fooobar.com/questions/589278/..., memory_limit - )

+2

, PHP. php.ini

0

, , . , PHP. , , , xdebug.

, :

  • , ​​ xdebug.
  • , PHP
0

All Articles