From 186131a271723b97ddaa7091ca7b45922176a578 Mon Sep 17 00:00:00 2001 From: Robert Sutherland <34408081+alpaca-farm@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:48:24 -0700 Subject: [PATCH] Update function.page.php In PHP 8, line 112 may produce a Type Error: Fatal error: Uncaught TypeError: Unsupported operand types: string - int [see https://stackoverflow.com/questions/66238017/fatal-error-uncaught-typeerror-unsupported-operand-types-string-int-in] To prevent this error, $current_page should be cast to int before the subtraction operation is done. --- smarty_plugins/function.page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smarty_plugins/function.page.php b/smarty_plugins/function.page.php index 4be8b7f..b30217e 100644 --- a/smarty_plugins/function.page.php +++ b/smarty_plugins/function.page.php @@ -109,7 +109,7 @@ function smarty_function_page($params, &$smarty) $smarty->right_delimiter = '}}'; $smarty->assign("eval_str", $template_info["content"]); - $smarty->assign("page_name", $template_vars["nav_pages"][$current_page - 1]["page_name"]); + $smarty->assign("page_name", $template_vars["nav_pages"][(int)$current_page - 1]["page_name"]); $smarty->assign("page_type", $page_type); // used in the form action attribute. This'll cause nice "/" paths for index.php to get redirected to index.php on