8000 [Serializer] Fix DataUriNormalizer's regex by dunglas · Pull Request #20286 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Closed
wants to merge 2 commits into from

Conversation

dunglas
Copy link
Member
@dunglas dunglas commented Oct 24, 2016
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

@dunglas
Copy link
Member Author
dunglas commented Oct 24, 2016

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)) {
Copy link
Contributor

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

@dunglas
Copy link
Member Author
dunglas commented Oct 24, 2016

I've updated the regex to be as close as possible of the ABNF syntax: https://tools.ietf.org/html/rfc6838#section-4.2

@javiereguiluz javiereguiluz added this to the 3.2 milestone Nov 7, 2016
@dunglas
Copy link
Member Author
dunglas commented Nov 10, 2016

ping @symfony/deciders

@xabbuh
Copy link
Member
xabbuh commented Nov 11, 2016

👍 LGTM

@fabpot
Copy link
Member
fabpot commented Nov 11, 2016

Thank you @dunglas.

fabpot added a commit that referenced this pull request Nov 11, 2016
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
@fabpot fabpot closed this Nov 11, 2016
@dunglas dunglas deleted the fix_20225 branch November 11, 2016 15:52
This was referenced Nov 17, 2016
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.

6 participants
0