Skip to content

Commit 54fc3c5

Browse files
javaDeveloperKidjavaDeveloperKid
javaDeveloperKid
authored and
javaDeveloperKid
committed
Fix passing null to trim()
1 parent 4a41159 commit 54fc3c5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/Symfony/Component/Yaml/Inline.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public static function initialize(int $flags, int $parsedLineNumber = null, stri
6060
*/
6161
public static function parse(string $value = null, int $flags = 0, array &$references = [])
6262
{
63+
if (null === $value) {
64+
return '';
65+
}
66+
6367
self::initialize($flags);
6468

6569
$value = trim($value);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ public static function getTestsForParse()
288288
{
289289
return [
290290
['', ''],
291+
[null, ''],
291292
['null', null],
292293
['false', false],
293294
['true', true],

0 commit comments

Comments
 (0)