Skip to content

Commit

Permalink
Use PmaAbsolueUri for cookie path
Browse files Browse the repository at this point in the history
Issue #12374

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Aug 17, 2016
1 parent 1099f68 commit 8347632
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libraries/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,15 @@ public function getCookiePath()
return $cookie_path;
}

$url = $this->get('PmaAbsoluteUri');

if (! empty($url)) {
$path = parse_url($url, PHP_URL_PATH);
if (! empty($path)) {
return $path;
}
}

$parsed_url = parse_url($GLOBALS['PMA_PHP_SELF']);

$parts = explode(
Expand Down
2 changes: 2 additions & 0 deletions test/classes/plugin/auth/AuthenticationCookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ public function testLogoutDelete()
$GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';
$GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';
$GLOBALS['cfg']['LoginCookieDeleteAll'] = true;
$GLOBALS['PMA_Config']->set('PmaAbsoluteUri', '');
$GLOBALS['cfg']['Servers'] = array(1);

$_COOKIE['pmaAuth-0'] = 'test';
Expand Down Expand Up @@ -497,6 +498,7 @@ public function testLogout()
$GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';
$GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';
$GLOBALS['cfg']['LoginCookieDeleteAll'] = false;
$GLOBALS['PMA_Config']->set('PmaAbsoluteUri', '');
$GLOBALS['cfg']['Servers'] = array(1);
$GLOBALS['server'] = 1;

Expand Down
1 change: 1 addition & 0 deletions test/libraries/PMA_user_preferences_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ public function testUserprefsRedirect()
'Cannot redefine constant/function - missing runkit extension'
);
}
$GLOBALS['PMA_Config']->set('PmaAbsoluteUri', '');

$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['lang'] = '';
Expand Down

0 comments on commit 8347632

Please sign in to comment.