Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
do not set a cookie if it finally has not changed #14116
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;
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.
@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 :)