0

I'm trying to upgrade to PHP 4.5 and everything is going flawless except logging out.

CakePHP 4.5.5

CakePHP/Authorisation 2.10.2

When logging out in:

APP/Controller/UsersController.php

public function logout()
{
    $result = $this->Authentication->getResult();

    if ($result->isValid()) {
       $this->Authentication->logout();
       return $this->redirect(['controller' => 'Users', 'action' => 'login']);
    }
}

I'm going to:

ROOT/vendor/cakephp/authentication/src/Controller/Component/AuthenticationComponent.php at line311 in Authentication\AuthenticationService->clearIdentity

$result = $this->getAuthenticationService()->clearIdentity(
     $controller->getRequest(),
     $controller->getResponse()
);

And further:

ROOT/vendor/cakephp/authentication/src/AuthenticationService.php at line224 in Authentication\Authenticator\SessionAuthenticator->clearIdentity

$result = $authenticator->clearIdentity($request, $response);

And it wants to renew the session:

ROOT/vendor/cakephp/authentication/src/Authenticator/SessionAuthenticator.php at line115 in Cake\Http\Session->renew

$sessionKey = $this->getConfig('sessionKey');
/** @var \Cake\Http\Session $session */
$session = $request->getAttribute('session');
$session->delete($sessionKey);
$session->renew();

It starts the new session

CORE/src/Http/Session.php at line649 in Cake\Http\Session->start

if (!$this->_hasSession() || $this->_isCLI) {
    return;
}
    
$this->start();
$params = session_get_cookie_params();

And crashes here:

CORE/src/Http/Session.php at line 352

if (session_status() === \PHP_SESSION_ACTIVE) {
    throw new RuntimeException('Session was already started');
}

This seems strange to me, code worked fine for CakePHP 4.3.

1
  • 1
    If you are facing any specific problem with code you didn't write on your own, please report this behaviour to the maintainers of that code
    – Nico Haase
    Commented May 22 at 14:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.