Skip to content

Commit

Permalink
bug #52332 [Yaml] Fix deprecated passing null to trim() (javaDevelope…
Browse files Browse the repository at this point in the history
…rKid)

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 #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()
  • Loading branch information
fabpot committed Oct 28, 2023
2 parents 9976f9c + 54fc3c5 commit b2e372d
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 b2e372d

Please sign in to comment.