Skip to content

Commit

Permalink
Fix passing null to trim()
Browse files Browse the repository at this point in the history
  • Loading branch information
javaDeveloperKid committed Oct 27, 2023
1 parent 4a41159 commit 54fc3c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Symfony/Component/Yaml/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public static function initialize(int $flags, int $parsedLineNumber = null, stri
*/
public static function parse(string $value = null, int $flags = 0, array &$references = [])
{
if (null === $value) {
return '';
}

self::initialize($flags);

$value = trim($value);
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Yaml/Tests/InlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ public static function getTestsForParse()
{
return [
['', ''],
[null, ''],
['null', null],
['false', false],
['true', true],
Expand Down

0 comments on commit 54fc3c5

Please sign in to comment.