From 454d2d85ff4e83af0468eb16da3ba6a2e29de402 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 28 Sep 2021 02:03:07 +0900 Subject: [PATCH] Fix #1790 duplicate .html extension in TemplateHandler error message --- classes/template/TemplateHandler.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 379f739b5..e3415dea6 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -144,7 +144,11 @@ class TemplateHandler if(!$this->file || !file_exists($this->file)) { $tpl_path = rtrim(str_replace('\\', '/', $tpl_path), '/') . '/'; - $error_message = "Template not found: ${tpl_path}${tpl_filename}.html" . ($tpl_file ? " (${tpl_file})" : ''); + $error_message = vsprintf('Template not found: %s%s%s', array( + $tpl_path, + preg_replace('/\.html$/i', '', $tpl_filename) . '.html', + $tpl_file ? " (${tpl_file})" : '', + )); trigger_error($error_message, \E_USER_WARNING); return escape($error_message); } @@ -213,7 +217,10 @@ class TemplateHandler if(!$this->file || !file_exists($this->file)) { $tpl_path = rtrim(str_replace('\\', '/', $tpl_path), '/') . '/'; - $error_message = "Template not found: ${tpl_path}${tpl_filename}.html"; + $error_message = vsprintf('Template not found: %s%s', array( + $tpl_path, + preg_replace('/\.html$/i', '', $tpl_filename) . '.html', + )); trigger_error($error_message, \E_USER_WARNING); return escape($error_message); }