From 41df7e42fd457369321e9874762d972440ab07fb Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 3 Aug 2023 11:26:15 +0530 Subject: [PATCH] Fix PHP warning due to occupancy query parameter in URL --- classes/controller/FrontController.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 2f19b9f61..f9e4338ef 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -917,11 +917,19 @@ class FrontControllerCore extends Controller } $excluded_key = array('isolang', 'id_lang', 'controller', 'fc', 'id_product', 'id_category', 'id_manufacturer', 'id_supplier', 'id_cms'); foreach ($_GET as $key => $value) { - if (!in_array($key, $excluded_key) && Validate::isUrl($key) && Validate::isUrl($value)) { - $params[Tools::safeOutput($key)] = Tools::safeOutput($value); + if (!in_array($key, $excluded_key)) { + if (is_string($value)) { + if (Validate::isUrl($key) && Validate::isUrl($value)) { + $params[Tools::safeOutput($key)] = Tools::safeOutput($value); + } + } else { + $tempValue = http_build_query($value); + if (Validate::isUrl($key) && Validate::isUrl($tempValue)) { + $params[Tools::safeOutput($key)] = $value; + } + } } } - $str_params = http_build_query($params, '', '&'); if (!empty($str_params)) { $final_url = preg_replace('/^([^?]*)?.*$/', '$1', $canonical_url).'?'.$str_params;