-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Fix DataUriNormalizer's regex #20286
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
Conversation
Q | A |
---|---|
Branch? | 3.1 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #20225 |
License | MIT |
Doc PR | n/a |
Travis error not related. |
@@ -85,7 +85,7 @@ public function supportsNormalization($data, $format = null) | |||
*/ | |||
public function denormalize($data, $class, $format = null, array $context = array()) | |||
{ | |||
if (!preg_match('/^data:([a-z0-9]+\/[a-z0-9]+(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) { | |||
if (!preg_match('/^data:([a-z0-9]+\/[a-z0-9\-\.\+]+(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the -
should be in the first part of mime also, to match types like x-conference/x-cooltalk
I've updated the regex to be as close as possible of the ABNF syntax: https://tools.ietf.org/html/rfc6838#section-4.2 |
ping @symfony/deciders |
👍 LGTM |
Thank you @dunglas. |
This PR was squashed before being merged into the 3.1 branch (closes #20286). Discussion ---------- [Serializer] Fix DataUriNormalizer's regex | Q | A | | --- | --- | | Branch? | 3.1 | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | #20225 | | License | MIT | | Doc PR | n/a | Commits ------- 5dc5dc8 [Serializer] Fix DataUriNormalizer's regex