Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Saml2/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,11 +966,12 @@ public static function isSessionStarted()
*/
public static function deleteLocalSession()
{
session_unset();

if (OneLogin_Saml2_Utils::isSessionStarted()) {
session_destroy();
}

unset($_SESSION);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions tests/src/OneLogin/Saml2/UtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ public function testGetselfhost()
public function testisHTTPS()
{
$this->assertFalse(OneLogin_Saml2_Utils::isHTTPS());

$_SERVER['HTTPS'] = 'on';
$this->assertTrue(OneLogin_Saml2_Utils::isHTTPS());

unset($_SERVER['HTTPS']);
$this->assertFalse(OneLogin_Saml2_Utils::isHTTPS());
$_SERVER['HTTP_HOST'] = 'example.com:443';
Expand Down Expand Up @@ -482,7 +482,7 @@ public function testSetBaseURL()
$expectedUrlNQ2 = 'http://anothersp.example.com:81/example2/route.php';
$expectedRoutedUrlNQ2 = 'http://anothersp.example.com:81/example2/route.php';
$expectedUrl2 = 'http://anothersp.example.com:81/example2/route.php?x=test';

$this->assertEquals('http', OneLogin_Saml2_Utils::getSelfProtocol());
$this->assertEquals('anothersp.example.com', OneLogin_Saml2_Utils::getSelfHost());
$this->assertEquals('81', OneLogin_Saml2_Utils::getSelfPort());
Expand Down Expand Up @@ -957,7 +957,7 @@ public function testDeleteLocalSession()
$this->assertTrue($_SESSION['samltest']);

OneLogin_Saml2_Utils::deleteLocalSession();
$this->assertEmpty($_SESSION);
$this->assertFalse(isset($_SESSION));
$this->assertFalse(isset($_SESSION['samltest']));

$prev = error_reporting(0);
Expand All @@ -966,7 +966,7 @@ public function testDeleteLocalSession()

$_SESSION['samltest'] = true;
OneLogin_Saml2_Utils::deleteLocalSession();
$this->assertEmpty($_SESSION);
$this->assertFalse(isset($_SESSION));
$this->assertFalse(isset($_SESSION['samltest']));
}
}
Expand Down