Very strange problem. The fact is that a couple of months ago I had a situation that when using DbSession I needed to identify unregistered users using a regular session (so that the administrator could log in to the admin area), the problem was not solved until I added the component session use cookies 'useCookies' => true . At the moment it has stopped working even with the use of cookies. It is possible that it could break due to changes in some configurations in the application (for example, changing the version of php 7.0 to 7.1). Any options and guesses fit, because at the moment I do not even know which way to dig. I really need help.
Here are the configurations of my DbSession:
'session' => [ 'class' => 'yii\web\DbSession', 'useCookies' => true, 'timeout' => 60 * 60, // 1 hour 'writeCallback' => function ($session) { // <удаляю повторяющиеся записи> return [ 'user_ip' => Yii::$app->request->userIP, 'user_id' => Yii::$app->user->id, 'last_write' => time(), ]; }, ], Here is my previous question , if you want to get acquainted in more detail.