From 208712796db93f514053b60c5b581af3ce7d549d Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Fri, 9 Oct 2015 08:36:37 +1100 Subject: [PATCH] Increase cookie version and improve cookie clearing Signed-off-by: Madhura Jayaratne --- libraries/common.inc.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/libraries/common.inc.php b/libraries/common.inc.php index f59fd453c3bb..32f9281f681e 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -286,17 +286,18 @@ * clean cookies on upgrade * when changing something related to PMA cookies, increment the cookie version */ -$pma_cookie_version = 4; -if (isset($_COOKIE) - && (isset($_COOKIE['pmaCookieVer']) - && $_COOKIE['pmaCookieVer'] < $pma_cookie_version) -) { - // delete all cookies - foreach ($_COOKIE as $cookie_name => $tmp) { - $GLOBALS['PMA_Config']->removeCookie($cookie_name); +$pma_cookie_version = 5; +if (isset($_COOKIE)) { + if (! isset($_COOKIE['pmaCookieVer']) + || $_COOKIE['pmaCookieVer'] < $pma_cookie_version + ) { + // delete all cookies + foreach ($_COOKIE as $cookie_name => $tmp) { + $GLOBALS['PMA_Config']->removeCookie($cookie_name); + } + $_COOKIE = array(); + $GLOBALS['PMA_Config']->setCookie('pmaCookieVer', $pma_cookie_version); } - $_COOKIE = array(); - $GLOBALS['PMA_Config']->setCookie('pmaCookieVer', $pma_cookie_version); }