From 54fc3c5cfaf67a9bfe89b0b39af87beabbc1618b Mon Sep 17 00:00:00 2001 From: javaDeveloperKid Date: Fri, 27 Oct 2023 20:30:51 +0200 Subject: [PATCH] Fix passing null to trim() --- src/Symfony/Component/Yaml/Inline.php | 4 ++++ src/Symfony/Component/Yaml/Tests/InlineTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 04c9690c9d1f3..5b5f96131af98 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -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); diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 8cd2582fdccc5..07d4e04d4375f 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -288,6 +288,7 @@ public static function getTestsForParse() { return [ ['', ''], + [null, ''], ['null', null], ['false', false], ['true', true],