diff --git a/src/Illuminate/Support/HtmlString.php b/src/Illuminate/Support/HtmlString.php index 624e7f3efa5..a2531113257 100644 --- a/src/Illuminate/Support/HtmlString.php +++ b/src/Illuminate/Support/HtmlString.php @@ -42,7 +42,7 @@ public function toHtml() */ public function isEmpty() { - return $this->html === ''; + return ($this->html ?? '') === ''; } /** @@ -62,6 +62,6 @@ public function isNotEmpty() */ public function __toString() { - return $this->toHtml(); + return $this->toHtml() ?? ''; } } diff --git a/tests/Support/SupportHtmlStringTest.php b/tests/Support/SupportHtmlStringTest.php index 1c3bb0fa313..f349a8a1ad2 100644 --- a/tests/Support/SupportHtmlStringTest.php +++ b/tests/Support/SupportHtmlStringTest.php @@ -39,6 +39,10 @@ public function testToString() $str = '