Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Twig Issues in Production #25

Open
pdugas opened this issue Dec 2, 2017 · 4 comments
Open

Twig Issues in Production #25

pdugas opened this issue Dec 2, 2017 · 4 comments

Comments

@pdugas
Copy link

pdugas commented Dec 2, 2017

There appears to be something missing from the modified Twig\Environment object. When the csrf_token() function is used in a template, I'm getting an error from the baseclass' getRuntime() method indicating it was unable to load Symfony\Bridge\Twig\Form\TwigRenderer. I worked around it by passing the token in from the controller instead of using the function in the template. I tried digging in to see what I could figure out but I'm not following what's going on in that class so I'm not really able to provide any insight into the root cause. Sorry.

@pdugas
Copy link
Author

pdugas commented Dec 4, 2017

Getting the same issue with app.user which appears to be null but if I pass in $this->getUser() from the controller and use that instead of app.user, things work as expected. Something's hosed with Twig in this setup still.

@pdugas
Copy link
Author

pdugas commented Dec 6, 2017

And another... Trying to add EasyAdminBundle. Had to patch around Doctrine's FileCache failing if the cache folder isn't writeable even though it's not trying to write to it javiereguiluz/EasyAdminBundle#1954 then ran into what I'm guessing is this Twig issue again.

request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Could not parse property path "[entities][]". Unexpected token "[" at position 10")." at /base/data/home/apps/p~xxx/staging.xxx/vendor/javiereguiluz/easyadmin-bundle/src/Resources/views/default/list.html.twig line 1 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Could not parse property path \"[entities][]\". Unexpected token \"[\" at position 10\"). at /base/data/home/apps/p~xxx/staging.xxx/vendor/javiereguiluz/easyadmin-bundle/src/Resources/views/default/list.html.twig:1, Symfony\\Component\\PropertyAccess\\Exception\\InvalidPropertyPathException(code: 0): Could not parse property path \"[entities][]\". Unexpected token \"[\" at position 10 at /base/data/home/apps/p~xxx/staging.xxx/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyPath.php:116)"} []

@pdugas pdugas changed the title Can't use csrf_token() Twig Issues in Production Dec 6, 2017
@pdugas
Copy link
Author

pdugas commented Dec 7, 2017

I've reached out to the Symfony folk here symfony/symfony#25368

@max4kaps
Copy link

max4kaps commented Dec 7, 2017

@pdugas , same here. I've changed :

twig:
strict_variables: true

To:

twig:
strict_variables: false

and it fixes the issue.

Hope the solution will be found soon...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants