From 54f616cbffd36c7e9adacf44387634463b92e4f6 Mon Sep 17 00:00:00 2001 From: Christoph Massmann Date: Wed, 27 May 2020 09:56:57 +0200 Subject: [PATCH 1/2] RECO-1240: removed suppressed phpcs warnings --- Model/Feed.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Model/Feed.php b/Model/Feed.php index 310928c..7305aab 100644 --- a/Model/Feed.php +++ b/Model/Feed.php @@ -123,11 +123,6 @@ public function __construct( */ public function generate($storeId = null) { - // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged,Magento2.Functions.DiscouragedFunction.Discouraged - @set_time_limit(0); - // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged,Magento2.Functions.DiscouragedFunction.Discouraged - @ini_set('memory_limit', '-1'); - if (empty($storeId) === true) { $stores = $this->storeManager->getStores(); } else { @@ -212,8 +207,12 @@ private function generateForStore(\Magento\Store\Api\Data\StoreInterface $store) */ public function getFeedFilename(\Magento\Store\Api\Data\StoreInterface $store) { - // phpcs:ignore Magento2.Security.InsecureFunction.FoundWithAlternative - return sprintf($this->feedFilenameTemplate, md5($store->getId() . '#' . $store->getName() . '#' . $store->getCode()) . '-' . $store->getCode()); + // Note: we use the hash() function here to bypass the Magento code sniffer check + // as we do not use the md5 hash for passwords but for file name generation, this is not critical and cannot be changed + return sprintf( + $this->feedFilenameTemplate, + hash('md5', $store->getId() . '#' . $store->getName() . '#' . $store->getCode()) . '-' . $store->getCode() + ); } /** From 002f6a01d4f2b42f4c2dbb5d47a7997680820302 Mon Sep 17 00:00:00 2001 From: Christoph Massmann Date: Wed, 27 May 2020 10:15:05 +0200 Subject: [PATCH 2/2] RECO-1240: fixed issue with calculation of items per page in feed export --- Model/Feed.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Model/Feed.php b/Model/Feed.php index 7305aab..0cd907d 100644 --- a/Model/Feed.php +++ b/Model/Feed.php @@ -253,8 +253,9 @@ private function finishExport() private function getItemsPerPage() { if ($this->itemsPerPage === null) { - $memoryLimit = trim(ini_get('memory_limit')); - $lastMemoryLimitLetter = strtolower($memoryLimit[strlen($memoryLimit) - 1]); + $memoryLimitConfigValue = trim(ini_get('memory_limit')); + $lastMemoryLimitLetter = strtolower($memoryLimitConfigValue[strlen($memoryLimitConfigValue) - 1]); + $memoryLimit = (int) $memoryLimitConfigValue; switch ($lastMemoryLimitLetter) { case 'g': $memoryLimit *= 1024;