From b9dbc449fe15bf2d3a45a8f0a8fdfc17a613571e Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 23 May 2025 14:41:46 +0530 Subject: [PATCH] Updated: Changes for PHP 8.x compatibility --- .../Core_Foundation_Exception_Exception.php | 2 +- .../IoC/Core_Foundation_IoC_Container.php | 4 +- README.md | 10 +- .../include/php_image_magician.php | 2 +- .../helpers/tree/tree_node_folder_radio.tpl | 2 +- .../normal_products/input_text_lang.tpl | 2 +- .../controllers/orders/helpers/view/view.tpl | 2 +- .../orders/modals/_add_room_booking.tpl | 2 +- .../controllers/products/features.tpl | 8 +- .../controllers/products/input_text_lang.tpl | 2 +- .../tree/tree_node_folder_checkbox.tpl | 2 +- .../helpers/tree/shop_tree_node_folder.tpl | 2 +- .../template/helpers/options/options.tpl | 2 +- .../helpers/tree/tree_node_folder.tpl | 2 +- .../tree/tree_node_folder_checkbox.tpl | 2 +- .../tree/tree_node_folder_checkbox_shops.tpl | 2 +- classes/AddressFormat.php | 4 + classes/AdminTab.php | 8 +- classes/AttributeGroup.php | 2 +- classes/CMS.php | 6 +- classes/CMSCategory.php | 8 +- classes/Carrier.php | 6 +- classes/Cart.php | 26 +-- classes/CartRule.php | 9 +- classes/Category.php | 18 +- classes/ConfigurationTest.php | 8 +- classes/ConnectionsSource.php | 4 +- classes/Context.php | 3 +- classes/Cookie.php | 3 +- classes/Country.php | 2 +- classes/Customer.php | 6 +- classes/DateRange.php | 2 +- classes/Discount.php | 4 +- classes/Feature.php | 2 +- classes/Group.php | 2 +- classes/Hook.php | 2 +- classes/ImageManager.php | 2 +- classes/Link.php | 10 +- classes/Mail.php | 212 ++++++++++++------ classes/Manufacturer.php | 2 +- classes/Media.php | 4 +- classes/Message.php | 4 +- classes/Meta.php | 11 +- classes/ObjectModel.php | 13 +- classes/PaymentModule.php | 3 +- classes/PrestaShopBackup.php | 2 +- classes/PrestaShopCollection.php | 21 +- classes/PrestaShopLogger.php | 5 +- classes/Product.php | 117 +++------- classes/ProductSale.php | 2 +- classes/RequestSql.php | 4 +- classes/Scene.php | 5 +- classes/Search.php | 9 +- classes/Store.php | 3 + classes/Tab.php | 21 +- classes/Tag.php | 2 +- classes/Tools.php | 16 +- classes/Translate.php | 6 +- classes/Uploader.php | 1 + classes/Validate.php | 28 +-- classes/cache/Cache.php | 1 + classes/cache/CacheMemcache.php | 2 +- .../checkoutProcess/AbstractCheckoutStep.php | 1 + classes/controller/AdminController.php | 126 +++++++---- classes/controller/FrontController.php | 3 + classes/db/DbPDO.php | 11 +- classes/helper/Helper.php | 8 + classes/helper/HelperKpi.php | 1 + classes/helper/HelperList.php | 47 +++- classes/helper/HelperOptions.php | 3 + classes/module/Module.php | 20 +- classes/order/Order.php | 18 +- classes/order/OrderDetail.php | 8 +- classes/order/OrderHistory.php | 2 +- classes/order/OrderReturn.php | 2 +- classes/order/OrderSlip.php | 2 +- classes/pdf/HTMLTemplate.php | 1 + classes/pdf/HTMLTemplateInvoice.php | 10 +- classes/pdf/PDF.php | 1 + classes/shop/Shop.php | 5 +- classes/shop/ShopUrl.php | 4 +- classes/stock/StockAvailable.php | 2 +- classes/stock/StockManager.php | 12 +- classes/stock/StockManagerInterface.php | 2 +- classes/tax/Tax.php | 2 +- classes/tax/TaxRule.php | 2 +- classes/tax/TaxRulesTaxManager.php | 2 +- classes/tree/Tree.php | 2 +- classes/webservice/WebserviceRequest.php | 3 +- .../WebserviceSpecificManagementBookings.php | 2 +- config/defines.inc.php | 2 +- 91 files changed, 574 insertions(+), 409 deletions(-) diff --git a/Core/Foundation/Exception/Core_Foundation_Exception_Exception.php b/Core/Foundation/Exception/Core_Foundation_Exception_Exception.php index 16b46fee2..b7953c2ab 100644 --- a/Core/Foundation/Exception/Core_Foundation_Exception_Exception.php +++ b/Core/Foundation/Exception/Core_Foundation_Exception_Exception.php @@ -26,7 +26,7 @@ class Core_Foundation_Exception_Exception extends Exception { - public function __construct($message = null, $code = 0, Exception $previous = null) + public function __construct($message = null, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/Core/Foundation/IoC/Core_Foundation_IoC_Container.php b/Core/Foundation/IoC/Core_Foundation_IoC_Container.php index 093ea79a6..6cc2faf66 100644 --- a/Core/Foundation/IoC/Core_Foundation_IoC_Container.php +++ b/Core/Foundation/IoC/Core_Foundation_IoC_Container.php @@ -105,9 +105,9 @@ class Core_Foundation_IoC_Container if ($classConstructor) { foreach ($classConstructor->getParameters() as $param) { - $paramClass = $param->getClass(); + $paramClass = ($param->getType() && !$param->getType()->isBuiltin()) ? new ReflectionClass($param->getType()>getName()) : null; if ($paramClass) { - $args[] = $this->doMake($param->getClass()->getName(), $alreadySeen); + $args[] = $this->doMake($paramClass->getName(), $alreadySeen); } elseif ($param->isDefaultValueAvailable()) { $args[] = $param->getDefaultValue(); } else { diff --git a/README.md b/README.md index 51ca925c0..7f126b4d4 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ The system compatibility will also be checked by the system with installation an #### Hosted Server Configurations * **Web server**: Apache 1.3, Apache 2.x, Nginx or Microsoft IIS -* **PHP version**: PHP 5.6+ to PHP 7.4 -* **MySQL version**: 5.1+ to 5.7 installed with a database created +* **PHP version**: PHP 8.1+ to PHP 8.4 +* **MySQL version**: 5.7+ to 8.4 installed with a database created * SSH or FTP access (ask your hosting service for your credentials) * In the PHP configuration ask your provider to set memory_limit to "128M", upload_max_filesize to "16M" , max_execution_time to "500" and allow_url_fopen "on" * SSL certificate if you plan to process payments internally (not using PayPal for instance) @@ -59,8 +59,8 @@ The system compatibility will also be checked by the system with installation an * **Supported operating system**: Windows, Mac, and Linux * **A prepared package**: WampServer (for Windows), Xampp (for Windows and Mac) or EasyPHP (for Windows) * **Web server**: Apache 1.3, Apache 2.x, Nginx or Microsoft IIS -* **PHP**: PHP 5.6+ to PHP 7.4 -* **MySQL** 5.1+ to 5.7 installed with a database created +* **PHP**: PHP 8.1+ to PHP 8.4 +* **MySQL** 5.7+ to 8.4 installed with a database created * In the PHP configuration, set memory_limit to "128M", upload_max_filesize to "16M" and max_execution_time to "500" * **Required PHP extensions**: PDO_MySQL, cURL, OpenSSL, SOAP, GD, SimpleXML, DOM, Zip, Phar @@ -88,7 +88,7 @@ Please don't disclose security vulnerabilities publicly. If you find any securit ### Documentation & Demo -#### QloApps Documentation +#### QloApps Documentation [https://qloapps.com/qlo-reservation-system](https://qloapps.com/qlo-reservation-system) #### QloApps Demo **Link** : https://demo.qloapps.com
diff --git a/admin/filemanager/include/php_image_magician.php b/admin/filemanager/include/php_image_magician.php index 1f384d2e9..0922a7236 100644 --- a/admin/filemanager/include/php_image_magician.php +++ b/admin/filemanager/include/php_image_magician.php @@ -455,7 +455,7 @@ class imageLib // *** Crop this bad boy $crop = imagecreatetruecolor($newWidth, $newHeight); $this->keepTransparancy($optimalWidth, $optimalHeight, $crop); - imagecopyresampled($crop, $this->imageResized, 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight, $newWidth, $newHeight); + imagecopyresampled($crop, $this->imageResized, 0, 0, (int) $cropStartX, (int) $cropStartY, (int) $newWidth, (int) $newHeight, (int) $newWidth, (int) $newHeight); $this->imageResized = $crop; diff --git a/admin/themes/default/template/controllers/groups/helpers/tree/tree_node_folder_radio.tpl b/admin/themes/default/template/controllers/groups/helpers/tree/tree_node_folder_radio.tpl index 4e635fb1d..2076fd73a 100644 --- a/admin/themes/default/template/controllers/groups/helpers/tree/tree_node_folder_radio.tpl +++ b/admin/themes/default/template/controllers/groups/helpers/tree/tree_node_folder_radio.tpl @@ -29,6 +29,6 @@ \ No newline at end of file diff --git a/admin/themes/default/template/controllers/normal_products/input_text_lang.tpl b/admin/themes/default/template/controllers/normal_products/input_text_lang.tpl index 7c280d602..81f63038a 100644 --- a/admin/themes/default/template/controllers/normal_products/input_text_lang.tpl +++ b/admin/themes/default/template/controllers/normal_products/input_text_lang.tpl @@ -38,7 +38,7 @@ id="{$input_name}_{$language.id_lang}" class="form-control {if isset($input_class)}{$input_class} {/if}" name="{$input_name}_{$language.id_lang}" - value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}" + value="{$input_value[$language.id_lang]|default:''|escape:'html'}" onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();" onblur="updateLinkRewrite();" {if isset($required)} required="required"{/if} diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index ae4377486..f7b0ebcba 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -595,7 +595,7 @@
  {$customer->date_add|date_format:"%d %b, %Y"} ({l s='Member since'})
  {$customerStats['nb_orders']|intval} ({l s='Total valid order placed'})
-
  {displayPrice price=Tools::ps_round(Tools::convertPrice($customerStats['total_spent'], $currency), 2) currency=$currency->id} ({l s='Total spent since registration'})
+
  {displayPrice price=Tools::ps_round(Tools::convertPrice($customerStats['total_spent']|floatval, $currency), 2) currency=$currency->id} ({l s='Total spent since registration'})
{if Configuration::get('PS_B2B_ENABLE')}
{$customer->siret} ({l s='Siret'})
{$customer->ape|date_format:"%d %b, %Y"} ({l s='APE'})
diff --git a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl index f9aa2d1ba..1011ddf6e 100644 --- a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl @@ -126,7 +126,7 @@ {/if} - {if sizeof($invoices_collection)} + {if isset($invoices_collection) && sizeof($invoices_collection)}