comparison vendor/symfony/serializer/Normalizer/DataUriNormalizer.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 1fec387a4317
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
77 * {@inheritdoc} 77 * {@inheritdoc}
78 * 78 *
79 * Regex adapted from Brian Grinstead code. 79 * Regex adapted from Brian Grinstead code.
80 * 80 *
81 * @see https://gist.github.com/bgrins/6194623 81 * @see https://gist.github.com/bgrins/6194623
82 *
83 * @throws InvalidArgumentException
84 * @throws UnexpectedValueException
85 */ 82 */
86 public function denormalize($data, $class, $format = null, array $context = array()) 83 public function denormalize($data, $class, $format = null, array $context = array())
87 { 84 {
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)) { 85 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)) {
89 throw new UnexpectedValueException('The provided "data:" URI is not valid.'); 86 throw new UnexpectedValueException('The provided "data:" URI is not valid.');