Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Symfony/Component/Yaml/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
class Inline
{
const REGEX_TAG_PATTERN = '((?P<tag>![\w!.\/:-]+) +)?';
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')';

private static $exceptionOnInvalidType = false;
Expand Down Expand Up @@ -481,6 +482,8 @@ private static function evaluateScalar($scalar, $references = array())
return;
case 0 === strpos($scalar, '!!float '):
return (float) substr($scalar, 8);
case 0 === strncmp($scalar, '!!binary ', 9):
return base64_decode(self::parseScalar(substr($scalar, 9)));
case ctype_digit($scalar):
$raw = $scalar;
$cast = (int) $scalar;
Expand Down
7 changes: 5 additions & 2 deletions src/Symfony/Component/Yaml/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,13 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $ob
return $this->refs[$value];
}

if (preg_match('/^'.self::FOLDED_SCALAR_PATTERN.'$/', $value, $matches)) {
if (preg_match('/^'.Inline::REGEX_TAG_PATTERN.self::FOLDED_SCALAR_PATTERN.'$/', $value, $matches)) {
$modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';

return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers));
$output = $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers));
if (isset($matches['tag']) && $matches['tag'] == '!!binary')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing curly braces

$output = base64_decode($output);
return $output;
}

try {
Expand Down