Skip to content

Commit 67dcc50

Browse files
author
Stanislav Idolov
authored
ENGCOM-3197: Ensure integer values are not quoted as strings #18611
2 parents ee76114 + d3973c3 commit 67dcc50

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-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
@@ -104,7 +104,7 @@ private function getCategoryIds(Filter $filter): array
104104
}
105105
}
106106

107-
return array_unique(array_merge($categoryIds, ...$childCategoryIds));
107+
return array_map('intval', array_unique(array_merge($categoryIds, ...$childCategoryIds)));
108108
}
109109

110110
/**

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ public function getCategoryIds($productId)
8080
Select::SQL_UNION_ALL
8181
);
8282

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

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

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,8 @@ protected function _productLimitationJoinWebsite()
18091809
}
18101810
$conditions[] = $this->getConnection()->quoteInto(
18111811
'product_website.website_id IN(?)',
1812-
$filters['website_ids']
1812+
$filters['website_ids'],
1813+
'int'
18131814
);
18141815
} elseif (isset(
18151816
$filters['store_id']
@@ -1821,7 +1822,7 @@ protected function _productLimitationJoinWebsite()
18211822
) {
18221823
$joinWebsite = true;
18231824
$websiteId = $this->_storeManager->getStore($filters['store_id'])->getWebsiteId();
1824-
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId);
1825+
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId, 'int');
18251826
}
18261827

18271828
$fromPart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM);
@@ -2017,12 +2018,16 @@ protected function _applyProductLimitations()
20172018

20182019
$conditions = [
20192020
'cat_index.product_id=e.entity_id',
2020-
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id']),
2021+
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id'], 'int'),
20212022
];
20222023
if (isset($filters['visibility']) && !isset($filters['store_table'])) {
2023-
$conditions[] = $this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility']);
2024+
$conditions[] = $this->getConnection()->quoteInto(
2025+
'cat_index.visibility IN(?)',
2026+
$filters['visibility'],
2027+
'int'
2028+
);
20242029
}
2025-
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id']);
2030+
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id'], 'int');
20262031
if (isset($filters['category_is_anchor'])) {
20272032
$conditions[] = $this->getConnection()->quoteInto('cat_index.is_parent=?', $filters['category_is_anchor']);
20282033
}

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

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

288288
// We run the actual indexer in batches.
289289
// Chunked AFTER loading to avoid duplicates in separate chunks.

0 commit comments

Comments
 (0)