From 5804fc61c73cfe9fa6787892b9d4443b1945946c Mon Sep 17 00:00:00 2001 From: pincombe Date: Fri, 19 Jan 2024 10:10:12 +0000 Subject: [PATCH 1/3] Fixed null value deprecation --- src/Former/Helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Former/Helpers.php b/src/Former/Helpers.php index 7e7fa1d4..cb450228 100644 --- a/src/Former/Helpers.php +++ b/src/Former/Helpers.php @@ -35,7 +35,7 @@ public static function setApp(Container $app) */ public static function encode($value) { - return htmlentities($value, ENT_QUOTES, 'UTF-8', true); + return htmlentities($value ?? '', ENT_QUOTES, 'UTF-8', true); } //////////////////////////////////////////////////////////////////// From 2ba553e25695170ad4d61ad7629fbae7e475e5e6 Mon Sep 17 00:00:00 2001 From: pincombe Date: Wed, 24 Jan 2024 09:32:57 +0000 Subject: [PATCH 2/3] Added null check to htmlentities helper --- src/Former/Helpers.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Former/Helpers.php b/src/Former/Helpers.php index cb450228..a5fbeeef 100644 --- a/src/Former/Helpers.php +++ b/src/Former/Helpers.php @@ -35,7 +35,12 @@ public static function setApp(Container $app) */ public static function encode($value) { - return htmlentities($value ?? '', ENT_QUOTES, 'UTF-8', true); + // Check if $value is null and return empty string + if ($value === null) { + return ''; + } + + return htmlentities($value, ENT_QUOTES, 'UTF-8', true); } //////////////////////////////////////////////////////////////////// From 174a535163fc36d6913c4d63eef1f086b100c84c Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Wed, 24 Jan 2024 11:20:33 +0100 Subject: [PATCH 3/3] CS --- src/Former/Helpers.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Former/Helpers.php b/src/Former/Helpers.php index a5fbeeef..5407714f 100644 --- a/src/Former/Helpers.php +++ b/src/Former/Helpers.php @@ -29,17 +29,16 @@ public static function setApp(Container $app) /** * Encodes HTML * - * @param string $value The string to encode + * @param string|null $value The string to encode * * @return string */ public static function encode($value) { - // Check if $value is null and return empty string if ($value === null) { - return ''; + return ''; } - + return htmlentities($value, ENT_QUOTES, 'UTF-8', true); }