From 76df7694de21dcffd6629ccb7b4143af3fa9d49d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 4 May 2023 11:15:43 +0200 Subject: [PATCH] Bug 17427: HACKY - force new session Look at Data::Session->new, it's calling $self -> load_session; Then look at load_session then user_id => we are retrieving the ID from the cookie But in our Auth.t tests we are mocking CGI->cookie to always return the previous CGISESSID We should certainly adjust the test here, and remove this patch. 194 # Note: We can test return values from checkauth here since we mocked the safe_exit after the Redirect 303 195 is( $return[0], $patron2->userid, 'Login of patron2 approved' ); 196 isnt( $return[2], $sessionID, 'Did not return previous session ID' ); 197 ok( $return[2], 'New session ID not empty' ); --- C4/Auth.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 22bfe811307..6ca328ec856 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1861,7 +1861,8 @@ sub _get_session_params { sub get_session { my $sessionID = shift; my $params = _get_session_params(); - my $session = Data::Session->new( %$params, id => $sessionID ) || die $Data::Session::errstr; + my $session = Data::Session->new( %$params, ($sessionID ? ( id => $sessionID ) : () ) ) || die $Data::Session::errstr; + $session->new_session unless $sessionID; return $session; } -- 2.25.1