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 authored and javaDeveloperKid committed Oct 27, 2023
1 parent 4cd2e3e commit c6980e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 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 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 c6980e8

Please sign in to comment.