From c6980e82a6656f6ebfabfd82f7585794cb122554 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() --- Inline.php | 4 ++++ Tests/InlineTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/Inline.php b/Inline.php index 04c9690c..5b5f9613 100644 --- a/Inline.php +++ b/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/Tests/InlineTest.php b/Tests/InlineTest.php index 8cd2582f..07d4e04d 100644 --- a/Tests/InlineTest.php +++ b/Tests/InlineTest.php @@ -288,6 +288,7 @@ public static function getTestsForParse() { return [ ['', ''], + [null, ''], ['null', null], ['false', false], ['true', true],