Skip to content

Commit f82470e

Browse files
committed
unique session every time by default
1 parent 8814abd commit f82470e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/phpunit-bootstrap.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,20 @@
4242
mb_convert_encoding("Hello, World!", "UTF-16")
4343
];
4444

45-
function switchUser(string $eppn, string $given_name, string $sn, string $mail): void
46-
{
45+
function switchUser(
46+
string $eppn,
47+
string $given_name,
48+
string $sn,
49+
string $mail,
50+
string|null $session_id = null
51+
): void {
4752
global $CONFIG, $REDIS, $LDAP, $SQL, $MAILER, $WEBHOOK, $GITHUB, $SITE, $SSO, $OPERATOR, $USER, $SEND_PIMESG_TO_ADMINS, $LOC_HEADER, $LOC_FOOTER;
4853
session_write_close();
49-
session_id(str_replace(["_", "@", "."], "-", $eppn));
54+
if (is_null($session_id)) {
55+
session_id(str_replace(["_", "@", "."], "-", uniqid($eppn . "_")));
56+
} else {
57+
session_id($session_id);
58+
}
5059
// session_start will be called on the first post()
5160
$_SERVER["REMOTE_USER"] = $eppn;
5261
$_SERVER["REMOTE_ADDR"] = "127.0.0.1";

0 commit comments

Comments
 (0)