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

Skip to content

[WebLink] Escape double quotes in attributes values #40209

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 16, 2021

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

If the attribute value contains a double quote, the serialized value is invalid: </foo>; rel="alternate"; title="foo " bar". Ideally we would use addcslashes but we can't because users that already pass escaped values would then be impacted.

@nicolas-grekas
Copy link
Member

shouldn't this be escaped with htmlspecialchars() instead?

@nicolas-grekas
Copy link
Member

shouldn't this be escaped with htmlspecialchars() instead?

or maybe not if this is for HTTP headers? any link to the relevant part of the spec?

@fancyweb
Copy link
Contributor Author

https://tools.ietf.org/html/rfc5988 says quoted-string from https://tools.ietf.org/html/rfc2616

quoted-string:

A string of text is parsed as a single word if it is quoted using
double-quote marks.

   quoted-string  = ( <"> *(qdtext | quoted-pair ) <"> )
   qdtext         = <any TEXT except <">>

The backslash character ("") MAY be used as a single-character
quoting mechanism only within quoted-string and comment constructs.

@fabpot
Copy link
Member

fabpot commented Feb 16, 2021

Thank you @fancyweb.

@fabpot fabpot merged commit f8ce7d0 into symfony:4.4 Feb 16, 2021
@fancyweb fancyweb deleted the web-link/escape branch February 16, 2021 12:16
This was referenced Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants