diff --git a/classes/Cookie.php b/classes/Cookie.php
index 67d941779..6a242b820 100644
--- a/classes/Cookie.php
+++ b/classes/Cookie.php
@@ -51,6 +51,8 @@ class CookieCore
protected $_iv;
protected $_modified = false;
+
+ protected $_allow_writing;
/**
* Get data if the cookie exists and else initialize an new one
@@ -71,6 +73,7 @@ class CookieCore
$this->_key = _COOKIE_KEY_;
$this->_iv = _COOKIE_IV_;
$this->_domain = $this->getDomain($shared_urls);
+ $this->_allow_writing = true;
if (Configuration::get('PS_CIPHER_ALGORITHM'))
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
else
@@ -78,6 +81,11 @@ class CookieCore
$this->update();
}
+ public function disallowWriting()
+ {
+ $this->_allow_writing = false;
+ }
+
protected function getDomain($shared_urls = null)
{
$r = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
@@ -325,7 +333,7 @@ class CookieCore
*/
public function write()
{
- if (!$this->_modified || headers_sent())
+ if (!$this->_modified || headers_sent() || !$this->_allow_writing)
return;
$cookie = '';
diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php
index a9c47d4f0..1b02797d6 100755
--- a/classes/controller/FrontController.php
+++ b/classes/controller/FrontController.php
@@ -657,6 +657,9 @@ class FrontControllerCore extends Controller
else
$final_url = preg_replace('/^([^?]*)?.*$/', '$1', $canonical_url);
+ // Don't send any cookie
+ Context::getContext()->cookie->disallowWriting();
+
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__)
die('[Debug] This page has moved
Please use the following URL instead: '.$final_url.'');