Fixed: apply additional Rector PHP 8.1–8.5 compatibility fixes

Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
amit sharma
2026-06-22 16:35:03 +05:30
parent c0eee98fb8
commit aa638429ca
10 changed files with 10 additions and 35 deletions

View File

@@ -1148,8 +1148,6 @@ class imageLib
imagecopy($comp, $im, 0, 0, 0, 0, $width, $height);
imagecopy($comp, $filter, 0, 0, 0, 0, $width, $height);
imagecopymerge($im, $comp, 0, 0, 0, 0, $width, $height, $amount);
imagedestroy($comp);
return $im;
}
@@ -1261,9 +1259,6 @@ class imageLib
}
$this->imageResized = $final;
imagedestroy($li);
imagedestroy($im);
}
@@ -1571,10 +1566,6 @@ class imageLib
imagesavealpha($rgb, true);
$this->imageResized = $rgb;
imagedestroy($image);
imagedestroy($newImage);
imagedestroy($shadow);
}
@@ -3320,7 +3311,6 @@ class imageLib
public function __destruct()
{
if (is_resource($this->imageResized)) {
imagedestroy($this->imageResized);
}
}

View File

@@ -352,7 +352,6 @@ function get_file_by_url($url)
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}

View File

@@ -285,7 +285,6 @@ class ImageManagerCore
$temp = imagecreatetruecolor($dst_w * $quality + 1, $dst_h * $quality + 1);
imagecopyresized($temp, $src_image, 0, 0, $src_x, $src_y, $dst_w * $quality + 1, $dst_h * $quality + 1, $src_w, $src_h);
imagecopyresampled($dst_image, $temp, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $dst_w * $quality, $dst_h * $quality);
imagedestroy($temp);
} else {
imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
}
@@ -321,7 +320,6 @@ class ImageManagerCore
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
$finfo = finfo_open($const);
$mime_type = finfo_file($finfo, $filename);
finfo_close($finfo);
} elseif (function_exists('mime_content_type')) {
$mime_type = mime_content_type($filename);
} elseif (function_exists('exec')) {
@@ -542,7 +540,6 @@ class ImageManagerCore
$success = imagejpeg($resource, $filename, (int)$quality);
break;
}
imagedestroy($resource);
@chmod($filename, 0664);
return $success;
}

View File

@@ -97,7 +97,7 @@ class TagCore extends ObjectModel
}
if (!is_array($tag_list)) {
$tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
$tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, 0, PREG_SPLIT_NO_EMPTY))));
}
$list = array();

View File

@@ -224,7 +224,7 @@ class ToolsCore
*
* @param string $url Desired URL
*/
public static function redirectAdmin($url)
public static function redirectAdmin($url): never
{
header('Location: '.$url);
exit;
@@ -1891,13 +1891,13 @@ class ToolsCore
}
$precision_places = 14 - floor(log10(abs($value)));
$f1 = pow(10.0, (double)abs($places));
$f1 = pow(10.0, (float) abs($places));
/* If the decimal precision guaranteed by FP arithmetic is higher than
* the requested places BUT is small enough to make sure a non-zero value
* is returned, pre-round the result to the precision */
if ($precision_places > $places && $precision_places - $places < 15) {
$f2 = pow(10.0, (double)abs($precision_places));
$f2 = pow(10.0, (float) abs($precision_places));
if ($precision_places >= 0) {
$tmp_value = $value * $f2;
@@ -1909,7 +1909,7 @@ class ToolsCore
* thus never larger than 1e15 here) */
$tmp_value = Tools::round_helper($tmp_value, $mode);
/* now correctly move the decimal point */
$f2 = pow(10.0, (double)abs($places - $precision_places));
$f2 = pow(10.0, (float) abs($places - $precision_places));
/* because places < precision_places */
$tmp_value = $tmp_value / $f2;
} else {
@@ -2091,7 +2091,6 @@ class ToolsCore
}
}
$content = curl_exec($curl);
curl_close($curl);
return $content;
} else {
return false;
@@ -2965,7 +2964,7 @@ exit;
/**
* @deprecated as of 1.5 use Controller::getController('PageNotFoundController')->run();
*/
public static function display404Error()
public static function display404Error(): never
{
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');

View File

@@ -1051,7 +1051,6 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
}
break;
}
imagedestroy($dest_image);
if (!$imaged) {
throw new WebserviceException(sprintf('Unable to write the image "%s".', str_replace(_PS_ROOT_DIR_, '[SHOP_ROOT_DIR]', $new_path)), array(70, 500));
}
@@ -1104,7 +1103,6 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
$finfo = finfo_open($const);
$mime_type = finfo_file($finfo, $file['tmp_name']);
finfo_close($finfo);
} elseif (Tools::isCallable('mime_content_type')) {
$mime_type = mime_content_type($file['tmp_name']);
} elseif (Tools::isCallable('exec')) {

View File

@@ -32,7 +32,7 @@
"source": "https://github.com/Qloapps/QloApps"
},
"require": {
"php": ">8.0 <8.5",
"php": ">8.0 <8.6",
"ext-curl": "*",
"ext-dom": "*",
"ext-gd": "*",

View File

@@ -58,7 +58,6 @@ class QdpDuitkuServiceRequest
curl_setopt_array($curl, $options);
$request = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
self::logResponse($request);
$response = array();

View File

@@ -60,8 +60,6 @@ class WkPaypalCommerceHelper
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
throw new PrestaShopException(sprintf('cURL Error #: %s', $err));
} else {
@@ -156,7 +154,6 @@ class WkPaypalCommerceHelper
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
throw new PrestaShopException(sprintf('cURL Error #: %s', $err));
@@ -215,8 +212,6 @@ class WkPaypalCommerceHelper
curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
throw new PrestaShopException(sprintf('cURL Error #: %s', $err));
}
@@ -255,8 +250,6 @@ class WkPaypalCommerceHelper
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
throw new PrestaShopException(sprintf('cURL Error #: %s', $err));
} else {

View File

@@ -30,9 +30,9 @@ class HttpHelper {
$this->_initCurl();
}
public function __destruct() {
curl_close($this->_curl);
}
public function __destruct()
{
}
private function _initCurl() {
if(!function_exists('curl_version')) {