Skip to content

Commit 6316620

Browse files
committed
Github #31984: fix for array offset bug during some 404s (PHP 7.4)
1 parent 336eac0 commit 6316620

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/code/Magento/CatalogUrlRewrite/Model/Storage/DynamicStorage.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,16 @@ private function findProductRewriteByRequestPath(array $data): ?array
179179
unset($data[UrlRewrite::IS_AUTOGENERATED]);
180180
$categoryFromDb = $this->connection->fetchRow($this->prepareSelect($data));
181181

182+
if ($categoryFromDb === false) {
183+
return null;
184+
}
185+
182186
if ($categoryFromDb[UrlRewrite::REDIRECT_TYPE]) {
183187
$productFromDb[UrlRewrite::REDIRECT_TYPE] = OptionProvider::PERMANENT;
184188
$categoryPath = str_replace($categorySuffix, '', $categoryFromDb[UrlRewrite::TARGET_PATH]);
185189
}
186190

187-
if ($categoryFromDb === false
188-
|| !$productResource->canBeShowInCategory(
191+
if (!$productResource->canBeShowInCategory(
189192
$productFromDb[UrlRewrite::ENTITY_ID],
190193
$categoryFromDb[UrlRewrite::ENTITY_ID]
191194
)

0 commit comments

Comments
 (0)