Closed
Description
Preconditions (*)
- Magento version 2.2.6
- create one block that contains a
{{trans}}
directive. Or 2 blocks with the same identifier but each one available on a different store view - Block cache must be enabled.
Steps to reproduce (*)
- Add the block in the layout and specify a cache lifetime
<block class="Magento\Cms\Block\Block" name="some-name-here">
<arguments>
<argument name="block_id" xsi:type="string">block-identifier-here</argument>
<argument name="cache_lifetime" xsi:type="number">84600</argument>
</arguments>
</block>
Expected result (*)
- Loading the pages that contain this block on 2 different store views will show the proper content of the block for each website
Actual result (*)
- Opening the page that contains the block on the second store view shows the cached version of the block from the first store view.
Additional info:
This happens because the cache key of the cms block is determined by Magento\Framework\View\Element\AbstractBlock::getCacheKey
which calls getCacheKeyInfo
from the same class which returns an array with the name of the block in the layout.
Possible solution:
Adding the store id to the cache key or to the array returned by getCacheKeyInfo
.
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.2 release lineThe 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 developmentIndicates that Pull Request has been created to fix issueThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.3 release