diff --git a/vendor/magento/module-store/App/Request/StorePathInfoValidator.php b/vendor/magento/module-store/App/Request/StorePathInfoValidator.php index abbf29fd0c916..e22742992d786 100644 --- a/vendor/magento/module-store/App/Request/StorePathInfoValidator.php +++ b/vendor/magento/module-store/App/Request/StorePathInfoValidator.php @@ -1,8 +1,9 @@ pathInfo->getPathInfo($request->getRequestUri(), $request->getBaseUrl()); } $storeCode = $this->getStoreCode($pathInfo); + if (empty($storeCode) || $storeCode === Store::ADMIN_CODE || !$this->storeCodeValidator->isValid($storeCode)) { return null; } + if (array_key_exists($storeCode, $this->validatedStoreCodes)) { + return $this->validatedStoreCodes[$storeCode]; + } + try { $this->storeRepository->getActiveStoreByCode($storeCode); + $this->validatedStoreCodes[$storeCode] = $storeCode; return $storeCode; } catch (NoSuchEntityException $e) { + $this->validatedStoreCodes[$storeCode] = null; return null; } catch (StoreIsInactiveException $e) { + $this->validatedStoreCodes[$storeCode] = null; return null; } } @@ -105,4 +120,12 @@ private function getStoreCode(string $pathInfo) : string $pathParts = explode('/', ltrim($pathInfo, '/'), 2); return current($pathParts); } + + /** + * @inheritDoc + */ + public function _resetState(): void + { + $this->validatedStoreCodes = []; + } } diff --git a/vendor/magento/framework/ObjectManager/ResetAfterRequestInterface.php b/vendor/magento/framework/ObjectManager/ResetAfterRequestInterface.php new file mode 100644 index 0000000000000..3ed92d8b30044 --- /dev/null +++ b/vendor/magento/framework/ObjectManager/ResetAfterRequestInterface.php @@ -0,0 +1,23 @@ +