Fix checking if the session is active

The phpversion check was backwards. For PHP >= 5.4.0 we should be
using session_status() === PHP_SESSION_ACTIVE not < 5.4.0.

But in fact, we only support >= 5.4.0, so this check is now redundant.
This commit is contained in:
Andrew Ruthven 2024-01-20 14:50:32 +13:00
parent ecda4395e8
commit 3bf44378fa

View File

@ -16,11 +16,7 @@ function updateCsrf() {
* @return bool
*/
function sessionExists() {
if (version_compare(phpversion(), '5.4.0', '>')) {
return session_id() !== '';
} else {
return session_status() === PHP_SESSION_ACTIVE;
}
return session_status() === PHP_SESSION_ACTIVE;
}
/**
@ -116,4 +112,4 @@ function verifyCsrf($csrf_token) {
*/
function verifyCsrfPost() {
return (isset($_POST['csrf_token']) && verifyCsrf($_POST['csrf_token']));
}
}