Skip to content
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

[create_framework] Add missing extract() 2nd arg #5522

Merged
merged 1 commit into from
Aug 20, 2015
Merged

Conversation

kenjis
Copy link
Contributor

@kenjis kenjis commented Jul 15, 2015

See previous page: http://symfony.com/doc/2.3/create_framework/templating.html

The code is extract($request->attributes->all(), EXTR_SKIP);.

In this page, suddenly EXTR_SKIP is missing. I don't know why.

@javiereguiluz
Copy link
Member

@kenjis 👍 thanks for reporting this error.

I can confirm this is an error. In the original article at Fabien's website, the EXTR_SKIP argument was present:

extr_skip_argument

@xabbuh
Copy link
Member

xabbuh commented Jul 15, 2015

@javiereguiluz The page that @kenjis changed is actual part 6, but I agree that it should be fixed here (using extract() might generally not be the best idea though).

@xabbuh
Copy link
Member

xabbuh commented Jul 15, 2015

Hm, actually I think it's right to not specify an argument here. The reason this was done in the previos chapters is that the default behaviour of extract() is to overwrite any existing variables with the same name. However, this is not a good idea in the global context as we might lose our very own framework variables. But this isn't issue anymore in the present code as the extract() call is wrapped in the render_template() function.

@kenjis
Copy link
Contributor Author

kenjis commented Jul 15, 2015

@xabbuh the extract() has moved into a function on prev page: http://symfony.com/doc/2.3/create_framework/templating.html
So if we remove EXTR_SKIP, we should do on prev page and add why.

@xabbuh
Copy link
Member

xabbuh commented Jul 15, 2015

@kenjis Yeah, I agree that it should simply be removed on the previous page.

@wouterj
Copy link
Member

wouterj commented Jul 28, 2015

Hi @kenjis! Thanks for the original fix and the discussion that came with it. As we concluded that the better fix would be to remove the argument from the templating guide, I've taken your commit and changed it so it can be merged: #5568

So I'm closing this PR, but you still get all the credits!

@wouterj wouterj closed this Jul 28, 2015
wouterj added a commit that referenced this pull request Jul 28, 2015
…njis)

This PR was merged into the 2.3 branch.

Discussion
----------

[Create Framework] Fix extract calls (replaces #5522)

Commits
-------

a9d75c6 Fix code
@wouterj wouterj reopened this Aug 20, 2015
@wouterj
Copy link
Member

wouterj commented Aug 20, 2015

Good news! We decided to add this argument to the other examples again, as it prevents overriding the $request variable. So it makes perfectly sense to merge this PR now. Thank you for creating it.

@wouterj wouterj merged commit 0905395 into symfony:2.3 Aug 20, 2015
wouterj added a commit that referenced this pull request Aug 20, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[create_framework] Add missing extract() 2nd arg

See previous page: http://symfony.com/doc/2.3/create_framework/templating.html

The code is `extract($request->attributes->all(), EXTR_SKIP);`.

In this page, suddenly `EXTR_SKIP` is missing. I don't know why.

Commits
-------

0905395 Fix code
@kenjis
Copy link
Contributor Author

kenjis commented Aug 20, 2015

My pleasure.

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

Successfully merging this pull request may close these issues.

4 participants