Closed
Description
Preconditions
- PHP 7.0.22
Steps to reproduce
- Install Magento CE 2.2.0-rc3.0 using composer
- Switch to developer mode
- In the backend, make sure you have 2 storeviews (in my example: Dutch & English)
- Reindex & flush caches
- Load the frontend
- Using the language switcher in the header, switch from the default storeview (Dutch in my example) to English, the url changes to:
https://example.com/?___store=en
- Using the language switcher in the header, switch again from English to Dutch, the url changes to:
https://example.com/?___store=en?___store=nl
and the shop crashes
Expected result
- The url should be
https://example.com/?___store=nl
and the shop shouldn't crash
Actual result
- The url is
https://example.com/?___store=en?___store=nl
and the shop crashes with the message:
1 exception(s):
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Requested store is not found
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Requested store is not found
#0 vendor/magento/module-store/Model/StoreManager.php(168): Magento\Store\Model\StoreRepository->get('en?___store=nl')
#1 vendor/magento/module-store/App/Action/Plugin/Context.php(85): Magento\Store\Model\StoreManager->getStore('en?___store=nl')
#2 vendor/magento/framework/Interception/Interceptor.php(121): Magento\Store\App\Action\Plugin\Context->beforeDispatch(Object(Magento\Cms\Controller\Index\Index\Interceptor), Object(Magento\Framework\App\Request\Http))
#3 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#4 generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(39): Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#5 vendor/magento/framework/App/FrontController.php(55): Magento\Cms\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#6 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#7 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#8 vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#9 vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#10 vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#11 vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#12 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#13 generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#14 vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#15 vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http->launch()
#16 pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#17 {main}
Discussion
This was only very recently broken, in commit: c3ea1f5, the changes in the file lib/internal/Magento/Framework/App/Request/Http.php
cause this.
Also: please change this typo from removeRepitedSlashes
to removeRepeatedSlashes
, so this method has the same name as in Magento 2.1
Possible solution
If we change this line from:
$requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/'));
to:
$requestString = $this->_url->escape(ltrim($this->_request->getOriginalPathInfo(), '/'));
It works again as expected, but I'm not sure yet if this is the correct solution.
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.3 release lineGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentThe issue has been reproduced on latest 2.2 release