-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes regression bug introduced in Magento 2.1.6 where the layered navigation options are sometimes being cached using the wrong store id. #9704
Conversation
* @param array $cacheTags | ||
* @codeCoverageIgnore | ||
*/ | ||
public function __construct( | ||
\Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory $attrBooleanFactory, | ||
CacheInterface $cache = null, | ||
StoreResolverInterface $storeResolver = null, | ||
StoreManagerInterface $storeManager = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a backward incompatible change,
and we can't just remove existing dependency and add another one instead.
So, existing dependency should be @deprecated
while new dependency added at the end of the list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? It only existed in Magento 2.1.6, in no other version. It would very much surprise me if any 3rd party already extends this class.
But if you really want me to add it as a new param, then I can do that.
Please let me know.
@maghamed: I applied your requested changes, please let me know if everything is ok now. Thanks! :) UPDATE: I forgot to mark the |
I just noticed the 3 failures in the static tests. I don't understand the first two, because there is a doc comment about the Please let me know how to resolve these static test failures. Thanks! :) |
[Tango] MAGETWO-66825: Caching of attribute options for Layered Navigation
I just see that this feature (with the same bug) has landed on the develop branch: 938313e |
After figuring out how to run these tests locally, I was able to suppress the third warning. The first two warnings feel like a bug in PHPCS itself, if I change the default assignment of the Anyway, I just pushed an update to suppress the third warning. |
I just pushed another update, which should fix all static tests. I took the approach like was done in 938313e with the I'm also still waiting on feedback about how to mark the Also: since this bug now also exists in the develop branch, who will take care of this? Should I create a new PR against the develop branch, or are you guys looking into this? Thanks! |
@maghamed or @okorshenko: it would be great if I could get some feedback on this PR, because it feels like this PR doesn't get any attention anymore from Magento. And since it fixes a regression bug it should get included in the next minor release preferably. Thanks! |
Hi @hostep , @ishakhsuvarov is working on this PR. Initial testing successfully passed. We are working right now on more detailed testing of this pull request. Thank you |
… the layered navigation options are sometimes being cached using the wrong store id. #9704
… the layered navigation options are sometimes being cached using the wrong store id. #9704
[EngCom] Public Pull Requests - 2.1 - MAGETWO-69665: Backport of MAGETWO-59089 for Magento 2.1: Magento 2.1.1 Problem with change currency #9841 - MAGETWO-69543: Fixes regression bug introduced in Magento 2.1.6 where the layered navigation options are sometimes being cached using the wrong store id. #9704 - MAGETWO-69151: Do not hardcode product link types [2.1 backport] #9601 - MAGETWO-69691: Travis build failures because the job exceeded the maximum time limit for jobs - 2.1-develop
@hostep thank you for your contribution |
@magento-team or @okorshenko: can you let me know who will take care of fixing this on the develop branch? Are you guys looking into this, or should I create a new PR for this? Thanks! |
@hostep I don't think it is in progress internally at the moment, so feel free to submit a PR for that. |
@ishakhsuvarov: new PR created for the develop branch: #9873 |
Description
Fixes problem with layered navigation options being cached using the wrong store id.
This problem only exists on Magento 2.1.6, not on the develop branch.
The problem was introduced in 67b5ff7
Fixed Issues (if relevant)
Manual testing scenarios
Discussion
This problem exists because the
$cacheKey
is using the default store id every time if you don't use the storeswitcher. So the wrong info is cached and being used from the cache in the above cases.The bug happens, because the original code calls
$this->storeResolver->getCurrentStoreId()
, this function checks if either the url has a '___store=xxx' param or if a cookie named 'store' exists. If neither of these things exist, it will return the default store view id.When you use the storeswitcher, it will set a cookie and the functionality will work. But what about visitors going to the url directly just after the cache was flushed? They will put the wrong info into the cache.
This PR targets the
2.1-develop
branch, as thedevelop
branch hasn't gotten this MAGETWO-65484 feature yet, which is strange...Inspiration of this PR came from this other PR, which fixes some similar issues: #9429
Would be really great if this could get included in the next minor release, as this is a pretty important bug which should get fixed ASAP.
It might be a good idea if this functionality is covered by some kind of test.
I have almost 0 experience with writing tests, so I won't do this for now, if somebody else is willing to do this, be my guest :)
Contribution checklist