OneLogin_Saml2_Utils::isSessionStarted PHP Method

isSessionStarted() public static method

Checks if the session is started or not.
public static isSessionStarted ( ) : boolean
return boolean true if the sessíon is started
    public static function isSessionStarted()
    {
        if (version_compare(phpversion(), '5.4.0', '>=')) {
            return session_status() === PHP_SESSION_ACTIVE ? true : false;
        } else {
            return session_id() === '' ? false : true;
        }
    }

Usage Example

Example #1
0
 /**
  * Tests the isSessionStarted method of the OneLogin_Saml2_Utils
  *
  * @covers OneLogin_Saml2_Utils::isSessionStarted
  */
 public function testisSessionStarted()
 {
     $this->assertFalse(OneLogin_Saml2_Utils::isSessionStarted());
     session_start();
     $this->assertTrue(OneLogin_Saml2_Utils::isSessionStarted());
 }
All Usage Examples Of OneLogin_Saml2_Utils::isSessionStarted