Skip to content

Commit c6980e8

Browse files
javaDeveloperKidjavaDeveloperKid
authored andcommitted
Fix passing null to trim()
1 parent 4cd2e3e commit c6980e8

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

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);

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)