Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] hinclude fragment renderer must escape URIs properly to return valid html #7090

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

Merged
merged 1 commit into from
Feb 20, 2013

Conversation

Tobion
Copy link
Contributor

@Tobion Tobion commented Feb 15, 2013

Q A
Bug fix? [yes]
New feature? [no]
BC breaks? [no]
Deprecations? [no]
Tests pass? [yes]
Fixed tickets [-]
License MIT
Doc PR [-]

Since rendering of hinclude fragments returns html/xml, it is marked as safe. So it's not auto-escaped of course. But that means it must properly escape it's input (the URI) when outputting in html context.
Btw, this does not need to be done for esi because esi tags are processed in middleware which do not go to the client/browser.

@Koc
Copy link
Contributor

Koc commented Feb 15, 2013

Will it works correct when arg_separator.output="&"?

@stof
Copy link
Member

stof commented Feb 15, 2013

if your url comes form the routing, yes. It does not rely on the default separator to avoid issues when the separator is configured to & as it would have been escaped again in Twig templates for instance.

@fabpot
Copy link
Member

fabpot commented Feb 16, 2013

Can you include the proper PR header in the description? Thanks.

@Tobion
Copy link
Contributor Author

Tobion commented Feb 16, 2013

Added.

fabpot added a commit that referenced this pull request Feb 20, 2013
This PR was merged into the 2.2 branch.

Commits
-------

54d7d25 [HttpKernel] hinclude fragment renderer must escape URIs properly to return valid html

Discussion
----------

[HttpKernel] hinclude fragment renderer must escape URIs properly to return valid html

| Q             | A
| ------------- | ---
| Bug fix?      | [yes]
| New feature?  | [no]
| BC breaks?    | [no]
| Deprecations? | [no]
| Tests pass?   | [yes]
| Fixed tickets | [-]
| License       | MIT
| Doc PR        | [-]

Since rendering of hinclude fragments returns html/xml, it is marked as safe. So it's not auto-escaped of course. But that means it must properly escape it's input (the URI) when outputting in html context.
Btw, this does not need to be done for esi because esi tags are processed in middleware which do not go to the client/browser.

---------------------------------------------------------------------------

by Koc at 2013-02-15T22:59:05Z

Will it works correct when `arg_separator.output="&"`?

---------------------------------------------------------------------------

by stof at 2013-02-15T23:04:01Z

if your url comes form the routing, yes. It [does not rely on the default separator](https://github.com/symfony/Routing/blob/master/Generator/UrlGenerator.php#L265) to avoid issues when the separator is configured to ``&`` as it would have been escaped again in Twig templates for instance.

---------------------------------------------------------------------------

by fabpot at 2013-02-16T07:26:19Z

Can you include the proper PR header in the description? Thanks.

---------------------------------------------------------------------------

by Tobion at 2013-02-16T12:28:18Z

Added.
@fabpot fabpot merged commit 54d7d25 into symfony:2.2 Feb 20, 2013
@Tobion Tobion deleted the fragment-render-escaping branch February 20, 2013 22:59
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