8000 bug #20286 [Serializer] Fix DataUriNormalizer's regex (dunglas) · symfony/symfony@75e0046 · GitHub
[go: up one dir, main page]

Skip to content

Commit 75e0046

Browse files
committed
bug #20286 [Serializer] Fix DataUriNormalizer's regex (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
2 parents a524ba5 + 5dc5dc8 commit 75e0046

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function supportsNormalization($data, $format = null)
8585
*/
8686
public function denormalize($data, $class, $format = null, array $context = array())
8787
{
88-
if (!preg_match('/^data:([a-z0-9]+\/[a-z0-9]+(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) {
88+
if (!preg_match('/^data:([a-z0-9][a-z0-9\!\#\$\&\-\^\_\+\.]{0,126}\/[a-z0-9][a-z0-9\!\#\$\&\-\^\_\+\.]{0,126}(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) {
8989
throw new UnexpectedValueException('The provided "data:" URI is not valid.');
9090
}
9191

0 commit comments

Comments
 (0)
0