- Magento 2.4.3
Steps to reproduce (*)
- Change website name + storename to something that has a number. Example: '2 Unlimited'
- Refund an order
- Tab: Credit Memos now gives an error The store that was requested wasn't found. Verify the store and try again. Exception in /data/web/magento2/vendor/magento/module-store/Model/StoreRepository.php:75
- Menu -> Sales -> Credit Memos gives an identical error
Expected result (*)
- Credit memo grid Shows
Actual result (*)
- Credit Memo Grid gives an error.
Workaround: Remove the numbers from the store name and website name
Tested it on an existing 2.4.3 installation + a fresh 2.4.3. installation. I have processed this through xdebug.
- It recursively loops trough components starting in: vendor/magento/framework/View/Element/UiComponent/Context.php:255, changing values by pass by reference.
- Eventually it will get to the store_id component. It will run the store ID parameter through the following function: vendor/magento/module-store/Ui/Component/Listing/Column/Store.php:93 -> PrepareItem().
- Since the functions are all passed by reference, the data changes. The store_id value changes from a simple integer to the following: "2unlimited.nl
" Note: the string contains nbsp and br tags
- Eventually it loops to the 'subtotal' component: vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php The store_id value that was changed is being used there. Function: prepareDataSource();
$storeId = isset($item['store_id']) && (int)$item['store_id'] !== 0 ? $item['store_id'] : $this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID); $store = $this->storeManager->getStore( $storeId );
Normally it gives a true & false value on the check, which causes the store_id to be set back to 0. However because there is a number in the storename (see string above), the (int) cast sets the int to 2. It now gives a true & true, and the store_id stays the strange string.
5. In the storerepository it eventually gets to the get() function, where it fails and gives the error.
vendor/magento/module-store/Model/StoreRepository.php: line 63, error on line 75.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- [ X] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.