Fix for PHP Notice: session_start(): A session had already been started (#1063)

Fix for PHP Notice: session_start(): A session had already been started - ignoring in var/www/html/baikal/Core/Frameworks/Flake/Framework.php on line 187
This commit is contained in:
Matt Gilchrist 2021-11-06 05:57:28 +10:00 committed by GitHub
parent 59f2fcd960
commit 5f59a70f02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -184,7 +184,9 @@ class Framework extends \Flake\Core\Framework {
if (!\Flake\Util\Tools::isCliPhp()) { if (!\Flake\Util\Tools::isCliPhp()) {
ini_set("html_errors", true); ini_set("html_errors", true);
session_start(); if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (!isset($_SESSION['CSRF_TOKEN'])) { if (!isset($_SESSION['CSRF_TOKEN'])) {
$_SESSION['CSRF_TOKEN'] = bin2hex(openssl_random_pseudo_bytes(20)); $_SESSION['CSRF_TOKEN'] = bin2hex(openssl_random_pseudo_bytes(20));
} }