10000 Problem with injection twig global variables Symfony 2.5 · Issue #12320 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

Problem with injection twig global variables Symfony 2.5 #12320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
judgedim opened this issue Oct 25, 2014 · 6 comments
Closed

Problem with injection twig global variables Symfony 2.5 #12320

judgedim opened this issue Oct 25, 2014 · 6 comments

Comments

@judgedim
Copy link

After upgrade from 2.4.10 to 2.5.6 I've got error

Variable "welcome_title" does not exist ...

config.yml

twig:
    globals:
        welcome_title: Welcome!

After investigation I've found difference in the app/cache/dev/appDevDebugProjectContainer.php

2.4.10

... 
$instance->addGlobal('app', $this->get('templating.globals'));
$instance->addGlobal('welcome_title', 'Welcome!');

return $instance;

2.5.x (I've tried few version: 2.5.1, 2.5.4, , 2.5.6)
only

...
$instance->addGlobal('app', $this->get('templating.globals'));

return $instance;

Bug?
Suggestions?

@judgedim judgedim changed the title Problem with injection twig global variables in the 2.5.* Problem with injection twig global variables in the 2.5 Oct 26, 2014
@judgedim judgedim changed the title Problem with injection twig global variables in the 2.5 Problem with injection twig global variables 2.5 Oct 26, 2014
@judgedim judgedim changed the title Problem with injection twig global variables 2.5 Problem with injection twig global variables Symfony 2.5 Oct 26, 2014
@weaverryan
Copy link
Member

Hi there!

I don't think anything has changed with this part of the code for a long time, so the change is surprising. You've done a nice job of debugging the code (to find the cached container). What I would do is open up TwigExtension (this one: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php).

Specifically, I would put some temporary var_dump/die or breakpoint code around here: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php#L87 to see what's happening.

Cheers!

@xabbuh
Copy link
Member
xabbuh commented Oct 28, 2014

@judgedim Can you provide a fork of the standard edition that makes it possible to reproduce your issue? I tested your configuration with Symfony 2.5 and 2.6 and it worked as expected.

@judgedim
Copy link
Author
judgedim commented Nov 1, 2014

Hi @weaverryan and @xabbuh ,

After additional debugging I've found problem in the my config related with changes in the Yaml Component, but as for me it seems a bit unexpected behavior

selection_241

@jakzal
Copy link
Contributor
jakzal commented Nov 1, 2014

@judgedim there was a bug in Symfony's Yaml parser that let you define duplicate keys. Duplicate keys are invalid according to the yaml specification and the bug was fixed in #10902.

@jakzal jakzal closed this as completed Nov 1, 2014
@judgedim
Copy link
Author
judgedim commented Nov 2, 2014

Thanks

7E2F

@Glideh
Copy link
Glideh commented Oct 8, 2015

Thank you very much @judgedim I had this issue after upgrading to Symfony 2.7

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

No branches or pull requests

5 participants
0