Skip to content

Commit b2e372d

Browse files
committed
bug symfony#52332 [Yaml] Fix deprecated passing null to trim() (javaDeveloperKid)
This PR was merged into the 5.4 branch. Discussion ---------- [Yaml] Fix deprecated passing null to trim() | Q | A | ------------- | --- | Branch? |5.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? |no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Closes symfony#52326 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT Commits ------- 54fc3c5 Fix passing null to trim()
2 parents 9976f9c + 54fc3c5 commit b2e372d

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)