Skip to content

Commit 4231479

Browse files
committed
must session_start before accessing $_SESSION
1 parent cc957c1 commit 4231479

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

resources/init.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@
3232
$WEBHOOK = new UnityWebhook();
3333
$GITHUB = new UnityGithub();
3434

35-
if (!array_key_exists("messages", $_SESSION)) {
36-
$_SESSION["messages"] = [];
37-
}
38-
39-
if (!array_key_exists("csrf_tokens", $_SESSION)) {
40-
$_SESSION["csrf_tokens"] = [];
41-
}
42-
4335
session_start();
4436
// https://stackoverflow.com/a/1270960/18696276
4537
if (time() - ($_SESSION["LAST_ACTIVITY"] ?? 0) > CONFIG["site"]["session_cleanup_idle_seconds"]) {
@@ -50,6 +42,14 @@
5042
}
5143
$_SESSION["LAST_ACTIVITY"] = time();
5244

45+
if (!array_key_exists("messages", $_SESSION)) {
46+
$_SESSION["messages"] = [];
47+
}
48+
49+
if (!array_key_exists("csrf_tokens", $_SESSION)) {
50+
$_SESSION["csrf_tokens"] = [];
51+
}
52+
5353
if (isset($_SERVER["REMOTE_USER"])) {
5454
// Check if SSO is enabled on this page
5555
$SSO = UnitySSO::getSSO();

0 commit comments

Comments
 (0)