musicmaster Posted November 10, 2022 Posted November 10, 2022 (edited) UPDATED After an upgrade to the latest bleeding edge I got the attached error. The error happens on the orders page in the backoffice and is obviously caused by the Whatsapp module. What puzzles me is that these function declarations and calls were the same under the old version where they didn't give a problem. The error message seems correct. Yet under the old version I didn't get an error. After some search I found that the GetAdminLink function in Link.php had been changed. The old version was: public function getAdminLink($controller, $withToken = true) { $idLang = Context::getContext()->language->id; $params = $withToken ? ['token' => Tools::getAdminTokenLite($controller)] : []; return Dispatcher::getInstance()->createUrl($controller, $idLang, $params, false); } The new version is: public function getAdminLink($controller, $withToken = true, $params = []) { $idLang = Context::getContext()->language->id; if ($withToken) { $params['token'] = Tools::getAdminTokenLite($controller); } return Dispatcher::getInstance()->createUrl($controller, $idLang, $params, false); } The puzzling thing is that the whatsappchat module calls it thus: $this->context->smarty->assign(array( 'action' => $this->l('WhatsApp'), 'action_whatsappchat' => $this->l('WhatsApp with this customer'), 'admin_base_dir' => $this->currentPageURL(), 'this_path_bo' => $this->_path, 'iso_code' => $this->context->language->iso_code, 'whatsappchat_admincontroller' => $this->context->link->getAdminLink('AdminWhatsappChat', true, $this->context->language->id), 'url' => false, 'show_button' => true, 'token' => Tools::getValue('token') )); So here the third argument is an integer. Edited November 13, 2022 by musicmaster
musicmaster Posted November 10, 2022 Author Posted November 10, 2022 I have made a provisional fix by adding in Link.php if (!is_array($params)) { $params = []; }
datakick Posted November 10, 2022 Posted November 10, 2022 Yeah, this is definitely a bug in the Whatsapp module. The proper way is to fix the module itself. Module should not pass integer as 3rd parameter. This method always accepted 2 parameters only (in ps16, and in all previous tb versions), so passing this 3rd parameter was always a no-op. We will see more issues like this in the future, with newer PHP versions being much more strict.
musicmaster Posted November 10, 2022 Author Posted November 10, 2022 The code I added was borrowed [with a twist] from the latest Prestashop 1.7. I haven't checked it but i wouldn't be surprised if for some PS versions this was what worked.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now