Logout issue

I’m using the logout link as stated below:

<a title="Logout" data-method="post" href="/user/logout">

If the user tries to logout from the website by clicking the link,the home page is loaded as if the user have logged out from the website but the moment the page is refreshed the user is automatically logged in.After that user have to again click on logout link.This thing happens rarely, unable to understand as if it is a caching bug or not.

Please help me out to resolve this issue.

Thank You.

Paste here the content of actionLogout from UserController.

$user_id = Yii::$app->user->identity->id;


// redirect

$logoutRedirect = Yii::$app->getModule("user")->logoutRedirect;

if ($logoutRedirect === null) {

return &#036;this-&gt;goHome();

} else {

return &#036;this-&gt;redirect(&#036;logoutRedirect);


Is there a reason to set $destroySession to false in logout() method? Does the same happen with this set to true (default)?

No there is no specific reason.It was true by default earlier and changed later to false.Further it does not affect if rolled back.

Since you are talking about a rare case, I cannot suggest anything more but additional testing. Try to pinpoint the bug, $logoutRedirect looks like potential source of the problem.

Thanks for your suggestion!

I’ll check accordingly but I just want to confer as if not the issue regarding cache handling.