Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bc095a5

Browse filesBrowse files
committed
[Yaml] Fix String offset cast error in Inline parser
1 parent 1d96df0 commit bc095a5
Copy full SHA for bc095a5

File tree

2 files changed

+13
-1
lines changed
Filter options

2 files changed

+13
-1
lines changed

‎src/Symfony/Component/Yaml/Inline.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Inline.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,10 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
458458

459459
// key
460460
$key = self::parseScalar($mapping, $flags, array(':', ' '), array('"', "'"), $i, false);
461-
$i = strpos($mapping, ':', $i);
461+
462+
if (false === $i = strpos($mapping, ':', $i)) {
463+
break;
464+
}
462465

463466
if (!isset($mapping[$i + 1]) || ' ' !== $mapping[$i + 1]) {
464467
@trigger_error('Omitting the space after the colon that follows a mapping key definition is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);

‎src/Symfony/Component/Yaml/Tests/InlineTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/InlineTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,4 +654,13 @@ public function getInvalidBinaryData()
654654
'misplaced equals character' => array('!!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'),
655655
);
656656
}
657+
658+
/**
659+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
660+
* @expectedExceptionMessage Malformed inline YAML string {this, is not, yaml}
661+
*/
662+
public function testStringOffsetCastError()
663+
{
664+
Inline::parse('{this, is not, yaml}');
665+
}
657666
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.