From d0e8bfb1257c0db2f38da4426fc52db8038263d2 Mon Sep 17 00:00:00 2001 From: Simon Erkelens Date: Mon, 29 Apr 2024 10:42:53 +1200 Subject: [PATCH] Ensure templateName is a valid value Calling `str_ireplace()` with null as `templateName`, causes a deprecation warning. Ensuring it's an empty string if it's null/false/etc. ensures this deprecation won't happen. Since passing an array to `str_ireplace()` as third parameter _is valid_, simply calling `(string)$templateName` would not suffice. --- code/Proxy/SSViewerProxy.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/Proxy/SSViewerProxy.php b/code/Proxy/SSViewerProxy.php index 7e8892f..0d33c2d 100644 --- a/code/Proxy/SSViewerProxy.php +++ b/code/Proxy/SSViewerProxy.php @@ -141,6 +141,10 @@ protected static function trackTemplateUsed($templateName) */ protected static function normalizeTemplateName($templateName) { + // Fallback for if the templateName is not a string or array (or anything, really) + if (!$templateName) { + $templateName = ''; + } return str_ireplace(BASE_PATH, '', $templateName); } }