-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Do not set a cookie if it finally has not changed #14116
Do not set a cookie if it finally has not changed #14116
Conversation
Makes sense ✅ Travis failed for bad reasons, I restart it |
Just curious, how did you end up thinking about this 😄? Did it impact badly performances on a shop you work on ? |
@matks Well actually I have a customer with the ps_categorytree module enabled, and it sets In that case, because a cookie is set, reverse proxy cannot cache the page. So I wanted to add an option to always reset the last_visited_category to null in my Varnish module, but because we just check the _modified flag, the cookie was still sent :) |
@PierreRambaud I think no QA is needed, is it ? |
@matks I was thinking about it, maybe just check everything still working as expected is enough? |
Thank you @jocel1 |
Instead of |
This modification could be useful if we are modifying several times the content of the prestashop cookie, to finally put at the end the same value than at the beginning.
Let's say for exemple we have
$this->context->cookie->last_visited_category == null
The front ProductController sets $this->context->cookie->last_visited_category = 2;
Hence _modified inside the cookie will be set to true.
Then we put back $this->context->cookie->last_visited_category = null; through a module
The _modified flag will still be true, and hence the cookie will be written even if there's no change inside it. This PR modify this behavior to avoir writing an unchanged cookie.
This change is