This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

PabloRQ
PabloRQ

Hi!

Working on a component, I try to use this on the default partial as it is on the documentation:

 {{ dump($var) }}

But I get this error:

Twig\Error\SyntaxError: Unknown "dump" function in

On the forum I found an old post about enable twig dump with an old solution, but I'm thinking that was a lot of improvements on this time that I'm expect the use of dump() function should be fixed.

Should it work out of the box or has to be configured in any way?

Regards...

mjauvin
mjauvin

dump() should work in twig, what version of october are you using?!

Also, twig does not use "$" in fromt of variable names so that should be {{ dump(var) }}

PabloRQ
PabloRQ

October build 464.

Yes, you're right: {{ dump(var) }}. My mistake when typing...

cryonos
cryonos

I confirm that it doesn't work:

{{ dump() }}

Gives an error 'unknown function do you mean var_dump...?' (It tried to debug a twig template in a Mail::send('myname.myplugin::mail.mytemplate', ... ) I use the last version of October

mjauvin
mjauvin

I think it only works in debug mode (app.debug=true)

cryonos
cryonos

mjauvin said:

I think it only works in debug mode (app.debug=true)

Debug mode is on, but I got this error:

"Unknown "dump" function. Did you mean "var_dump" in "__string_template__ca89786fac42d5dcb6c2589ec02085c2e823ad64c086a6a1c4b74a9c58f5ee63" at line 1?" on line 746 of /home/******/vendor/twig/twig/src/ExpressionParser.php
cryonos
cryonos

Maybe it's a bug due to the plugin Twig Extensions?

https://octobercms.com/plugin/vojtasvoboda-twigextensions

mjauvin
mjauvin

{{ dump() }} is working for me.

Try disabling this plugin, you'll see.

1-8 of 8

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.