Fixed PHP 8 compatibility issues

This commit is contained in:
vishalsingh.qlo325
2025-06-03 16:18:16 +05:30
parent b5e458e583
commit da49d2e262
9 changed files with 22 additions and 19 deletions

View File

@@ -1107,12 +1107,12 @@ class ToolsCore
*
* @see error_log()
* @param mixed $object
* @param int|null $message_type
* @param int $message_type
* @param string|null $destination
* @param string|null $extra_headers
* @return bool
*/
public static function error_log($object, $message_type = null, $destination = null, $extra_headers = null)
public static function error_log($object, $message_type = 0, $destination = null, $extra_headers = null)
{
return error_log(print_r($object, true), $message_type, $destination, $extra_headers);
}

View File

@@ -2826,6 +2826,11 @@ class AdminControllerCore extends Controller
$helper->actions = $this->actions;
}
// For each action, try to add the corresponding skip elements listAdd commentMore actions
$helper->list_skip_actions = $this->list_skip_actions;
$helper->orderBy = $this->_orderBy;
$helper->orderWay = $this->_orderWay;
$this->helper = $helper;
}

View File

@@ -28,6 +28,7 @@
* @TODO Move undeclared variables and methods to this (base) class: $errors, $layout, checkLiveEditAccess, etc.
* @since 1.5.0
*/
#[\AllowDynamicProperties]
abstract class ControllerCore
{
/** @var Context */

View File

@@ -602,11 +602,6 @@ class HelperListCore extends Helper
$total_pages = max(1, ceil($this->listTotal / $pagination));
$identifier = Tools::getIsset($this->identifier) ? '&'.$this->identifier.'='.(int)Tools::getValue($this->identifier) : '';
$order = '';
if (Tools::getIsset($this->table.'Orderby')) {
$order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay));
}
$action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->list_id;
/* Determine current page number */

View File

@@ -2964,7 +2964,7 @@ class AdminNormalProductsControllerCore extends AdminController
$allAssociations = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id);
if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product->selling_preference_type) {
$associatedRoomTypes = $allAssociations['room_type'];
$selectedRoomTypes = Tools::getValue('room_type_box');
$selectedRoomTypes = Tools::getValue('room_type_box', array());
// Generate list of new associations
$newRoomTypes = array();
@@ -3005,7 +3005,7 @@ class AdminNormalProductsControllerCore extends AdminController
);
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product->selling_preference_type) {
$associatedHotels = $allAssociations['hotel'];
$selectedHotel = Tools::getValue('hotel_box');
$selectedHotel = Tools::getValue('hotel_box', array());
// Generate list of new associations
$newHotels = array();
foreach ($selectedHotel as $selectedRoomType) {
@@ -3046,7 +3046,7 @@ class AdminNormalProductsControllerCore extends AdminController
} elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product->selling_preference_type) {
// Add room types linking
$associatedRoomTypes = $allAssociations['room_type'];
$selectedRoomTypes = Tools::getValue('room_type_box');
$selectedRoomTypes = Tools::getValue('room_type_box', array());
// Generate list of new associations
$newRoomTypes = array();
foreach ($selectedRoomTypes as $selectedRoomType) {
@@ -3083,7 +3083,7 @@ class AdminNormalProductsControllerCore extends AdminController
// Add hotels linking
$associatedHotels = $allAssociations['hotel'];
$selectedHotel = Tools::getValue('hotel_box');
$selectedHotel = Tools::getValue('hotel_box', array());
// Generate list of new associations
$newHotels = array();
foreach ($selectedHotel as $selectedRoomType) {
@@ -3407,6 +3407,7 @@ class AdminNormalProductsControllerCore extends AdminController
// Get all id_product_attribute
$attributes = $obj->getAttributesResume($this->context->language->id);
if (empty($attributes)) {
$attributes = array();
$attributes[] = array(
'id_product_attribute' => 0,
'attribute_designation' => ''

View File

@@ -570,7 +570,9 @@ class AuthControllerCore extends FrontController
}
}
}
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
if (!(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')
&& !@checkdate((int) Tools::getValue('months'), (int) Tools::getValue('days'), (int) Tools::getValue('years'))
) {
$this->errors[] = Tools::displayError('Invalid date of birth');
}

View File

@@ -61,8 +61,8 @@ class CartControllerCore extends FrontController
$this->id_product = (int)Tools::getValue('id_product', null);
$this->id_product_attribute = (int)Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
$this->customization_id = (int)Tools::getValue('id_customization');
$this->qty = abs(Tools::getValue('qty', 1));
$this->id_hotel = abs(Tools::getValue('id_hotel', null));
$this->qty = abs((int) Tools::getValue('qty', 1));
$this->id_hotel = abs((int) Tools::getValue('id_hotel', 0));
$this->id_address_delivery = (int)Tools::getValue('id_address_delivery');
}

View File

@@ -286,8 +286,9 @@ class Blockcart extends Module
null,
$this->context->cart->id_shop
);
$image = Product::getCover($objProduct->id);
$image['id_product'] = $objProduct->id;
if ($image = Product::getCover($objProduct->id)) {
$image['id_product'] = $objProduct->id;
}
// Product::defineProductImage(array(Product::getCover($objProduct->id)['id_image']/), $this->id_lang)
$addedProduct['image'] = $this->context->link->getImageLink(
$objProduct->link_rewrite,

View File

@@ -746,9 +746,7 @@ class HotelBranchInformation extends ObjectModel
$catName = $name;
}
$category->name[$lang['id_lang']] = $catName;
$category->description[$lang['id_lang']] = $this->moduleInstance->l(
'Hotel Branch Category', 'HotelBranchInformation'
);
$category->description[$lang['id_lang']] = $this->moduleInstance->l('Hotel Branch Category', 'HotelBranchInformation');
if (is_array($link_rewrite)) {
$category->link_rewrite[$lang['id_lang']] = $link_rewrite[$lang['id_lang']];