diff --git a/src/SimpleSAML/Configuration.php b/src/SimpleSAML/Configuration.php
index 3d959a1b789637804a3a0ea939005b4411665731..d447c7bb7433f93874b7432d5b5341b30e69f458 100644
--- a/src/SimpleSAML/Configuration.php
+++ b/src/SimpleSAML/Configuration.php
@@ -18,6 +18,7 @@ use function dirname;
 use function interface_exists;
 use function is_array;
 use function is_int;
+use function is_null;
 use function is_string;
 use function ob_end_clean;
 use function ob_get_length;
@@ -415,7 +416,7 @@ class Configuration implements Utils\ClearableState
      */
     public function hasValue(string $name): bool
     {
-        return array_key_exists($name, $this->configuration);
+        return array_key_exists($name, $this->configuration) && !is_null($this->configuration[$name]);
     }
 
 
diff --git a/src/SimpleSAML/SessionHandlerPHP.php b/src/SimpleSAML/SessionHandlerPHP.php
index b8e83a88588bca95bde6dad9f9b34fbddc513644..f1d70e31f41e501cfbee8048dfe35e3ae4abcce3 100644
--- a/src/SimpleSAML/SessionHandlerPHP.php
+++ b/src/SimpleSAML/SessionHandlerPHP.php
@@ -54,7 +54,7 @@ class SessionHandlerPHP extends SessionHandler
         );
 
         if (session_status() === PHP_SESSION_ACTIVE) {
-            if (session_name() === $this->cookie_name || $this->cookie_name === null) {
+            if (session_name() === $this->cookie_name) {
                 Logger::warning(
                     'There is already a PHP session with the same name as SimpleSAMLphp\'s session, or the ' .
                     "'session.phpsession.cookiename' configuration option is not set. Make sure to set " .
diff --git a/tests/src/SimpleSAML/ConfigurationTest.php b/tests/src/SimpleSAML/ConfigurationTest.php
index 013e4721eb141d59d30d214c453dddf944a236b1..060f00ffd430116baffe2ba13f70fb68d063c7e5 100644
--- a/tests/src/SimpleSAML/ConfigurationTest.php
+++ b/tests/src/SimpleSAML/ConfigurationTest.php
@@ -72,7 +72,10 @@ class ConfigurationTest extends ClearStateTestCase
 
         // Normal use
         $this->assertTrue($c->getValue('exists_true'));
-        $this->assertNull($c->getValue('exists_null'));
+
+        // Null option
+        $this->expectException(AssertionFailedException::class);
+        $c->getValue('exists_null');
 
         // Missing option
         $this->expectException(AssertionFailedException::class);
@@ -108,7 +111,7 @@ class ConfigurationTest extends ClearStateTestCase
         ]);
         $this->assertEquals($c->hasValue('missing'), false);
         $this->assertEquals($c->hasValue('exists_true'), true);
-        $this->assertEquals($c->hasValue('exists_null'), true);
+        $this->assertEquals($c->hasValue('exists_null'), false);
     }
 
 
@@ -124,7 +127,7 @@ class ConfigurationTest extends ClearStateTestCase
         $this->assertEquals($c->hasValueOneOf([]), false);
         $this->assertEquals($c->hasValueOneOf(['missing']), false);
         $this->assertEquals($c->hasValueOneOf(['exists_true']), true);
-        $this->assertEquals($c->hasValueOneOf(['exists_null']), true);
+        $this->assertEquals($c->hasValueOneOf(['exists_null']), false);
 
         $this->assertEquals($c->hasValueOneOf(['missing1', 'missing2']), false);
         $this->assertEquals($c->hasValueOneOf(['exists_true', 'missing']), true);