From 0af4bc2dbca4d0c99ee860f3ce02c9a8e9d64e22 Mon Sep 17 00:00:00 2001 From: itinerare Date: Tue, 31 Dec 2024 11:17:54 -0500 Subject: [PATCH] fix: only decode parsed HTML special chars if not null --- app/Http/Middleware/ParsePostRequestFields.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/ParsePostRequestFields.php b/app/Http/Middleware/ParsePostRequestFields.php index ce8e3a0b4..8f64ed8a8 100644 --- a/app/Http/Middleware/ParsePostRequestFields.php +++ b/app/Http/Middleware/ParsePostRequestFields.php @@ -34,7 +34,9 @@ public function handle(Request $request, Closure $next) { } // Decode HTML special chars - $parsedFields[$key] = htmlspecialchars_decode($parsedFields[$key]); + if ($parsedFields[$key] != null) { + $parsedFields[$key] = htmlspecialchars_decode($parsedFields[$key]); + } } } @@ -63,7 +65,9 @@ private function parseArray(array $array, array $strippedFields): array { } // Decode HTML special chars - $array[$key] = htmlspecialchars_decode($array[$key]); + if ($array[$key] != null) { + $array[$key] = htmlspecialchars_decode($array[$key]); + } } }