8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Assetic error in Symfony 2.7 #20

Closed foaly-nr1 closed 6 years ago

foaly-nr1 commented 9 years ago

When warming up the cache, assetic is throwing the following error: assetic.ERROR: The template "GuzzleBundle::profiler.html.twig" contains an error: The function "dump" does not exist in "GuzzleBundle::profiler.html.twig" at line 47

This is because dump was introduced in added in Twig 1.5 and Symfony 2.7 seems to be using Twig 1.2.

florianpreusner commented 9 years ago

Hi,

sorry for this late reply. Symfony 2.7.0 requires twig ~1.18. The bridge (posted link) requires ~1.20. Both versions are higher than 1.5. I'm not able to reproduce this error. Can you check which version of twig is installed by looking into composer.lock?

Best regards Florian

mlebkowski commented 8 years ago

I have the same issue in my production environment. Symfony v2.6.10, Twig v1.18.2, GuzzleBundle v4.2.1.

This is because twig only loads the debug extension (with dump function) in debug mode. Run this with empty cache (rm -fr app/cache/prod) to confirm:

app/console assetic:dump --no-debug --env=prod
sebastianblum commented 8 years ago

The problem is, that the method Dump is only available in environments with enabled debugging.

So in production, the dump method is not available.

see http://twig.sensiolabs.org/doc/functions/dump.html

The dump function is not available by default. You must add the Twig_Extension_Debug extension explicitly when creating your Twig environment:

Maybe we should write a custom twig function that uses the var_dump function with enabled debugging.

florianpreusner commented 8 years ago

Yes, this could be a solution!

asprega commented 8 years ago

Reviving this thread: I wonder what's the point of having debug stuff available when you're warming up a non-debug cache. Couldn't we just "exclude" that when the kernel debug flag is set to false?

gregurco commented 6 years ago

@foaly-nr1 @mlebkowski @sebastianblum @asprega fixed in PR #164

florianpreusner commented 6 years ago

Released in v7.3.0 (https://github.com/8p/EightPointsGuzzleBundle/releases/tag/7.3.0)