Skip to content

Commit 8418e99

Browse files
author
Stanislav Idolov
authored
ENGCOM-3298: Ensure integer values are not quoted as strings #18287
2 parents b263595 + f845652 commit 8418e99

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ProductCategoryCondition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private function getCategoryIds(Filter $filter): array
102102
}
103103
}
104104

105-
return array_unique(array_merge($categoryIds, ...$childCategoryIds));
105+
return array_map('intval', array_unique(array_merge($categoryIds, ...$childCategoryIds)));
106106
}
107107

108108
/**

app/code/Magento/Catalog/Model/ProductCategoryList.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ public function getCategoryIds($productId)
8181
Select::SQL_UNION_ALL
8282
);
8383

84-
$this->categoryIdList[$productId] = $this->productResource->getConnection()->fetchCol($unionSelect);
84+
$this->categoryIdList[$productId] = array_map(
85+
'intval',
86+
$this->productResource->getConnection()->fetchCol($unionSelect)
87+
);
8588
}
8689

8790
return $this->categoryIdList[$productId];

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,8 @@ protected function _productLimitationJoinWebsite()
18031803
}
18041804
$conditions[] = $this->getConnection()->quoteInto(
18051805
'product_website.website_id IN(?)',
1806-
$filters['website_ids']
1806+
$filters['website_ids'],
1807+
'int'
18071808
);
18081809
} elseif (isset(
18091810
$filters['store_id']
@@ -1815,7 +1816,7 @@ protected function _productLimitationJoinWebsite()
18151816
) {
18161817
$joinWebsite = true;
18171818
$websiteId = $this->_storeManager->getStore($filters['store_id'])->getWebsiteId();
1818-
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId);
1819+
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId, 'int');
18191820
}
18201821

18211822
$fromPart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM);
@@ -2011,12 +2012,12 @@ protected function _applyProductLimitations()
20112012

20122013
$conditions = [
20132014
'cat_index.product_id=e.entity_id',
2014-
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id']),
2015+
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id'], 'int'),
20152016
];
20162017
if (isset($filters['visibility']) && !isset($filters['store_table'])) {
2017-
$conditions[] = $this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility']);
2018+
$conditions[] = $this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility'], 'int');
20182019
}
2019-
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id']);
2020+
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id'], 'int');
20202021
if (isset($filters['category_is_anchor'])) {
20212022
$conditions[] = $this->getConnection()->quoteInto('cat_index.is_parent=?', $filters['category_is_anchor']);
20222023
}

lib/internal/Magento/Framework/Mview/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function update()
285285
for ($versionFrom = $lastVersionId; $versionFrom < $currentVersionId; $versionFrom += $versionBatchSize) {
286286
// Don't go past the current version for atomicy.
287287
$versionTo = min($currentVersionId, $versionFrom + $versionBatchSize);
288-
$ids = $this->getChangelog()->getList($versionFrom, $versionTo);
288+
$ids = array_map('intval', $this->getChangelog()->getList($versionFrom, $versionTo));
289289

290290
// We run the actual indexer in batches. Chunked AFTER loading to avoid duplicates in separate chunks.
291291
$chunks = array_chunk($ids, $batchSize);

0 commit comments

Comments
 (0)