After the transfer, the creation of the user session has ceased to occur. However, authorization occurs. Authorization do so

if ($this->validate()) { $db = new User(); foreach($db->find()->where(['username' => $this->username])->all() as $key=>$val) { return Yii::$app->user->login($val, $this->rememberMe ? 3600*24*30 : 0); } $db->username = $this->username; $db->password = sha1($this->password); $db->password_hash = sha1($this->password); $db->created_at = strtotime(time()); $db->updated_at = strtotime(time()); $db->email = $this->username; $db->status = 1; $db->auth_key = 1; $db->password_reset_token = sha1($this->password); $db->save(); return Yii::$app->user->login($db, $this->rememberMe ? 3600*24*30 : 0); } 

When iterating through the forex, I get the user object from the database. Further

 return Yii::$app->user->login($val, $this->rememberMe ? 3600*24*30 : 0); 

Then magic happens - authorization happens, but when var_dump is displayed (Yii :: $ app-> user); Gives an object without the necessary parameters, apparently with the recording of sessions ... Help me figure out, there is access to the server. It is necessary to understand why does not record the session.

    1 answer 1

    Well, if the code has not changed, then I think the reason should be sought in the server configuration. Try checking on both servers. Plus the config with the parameters session , request and user would not hurt

     $params = [ 'session.auto_start', 'session.name', 'session.save_path', 'session.gc_maxlifetime', 'session.cookie_lifetime', 'session.cookie_lifetime', 'session.cookie_path', 'session.cookie_domain', 'session.cookie_secure', 'session.cookie_httponly', 'session.use_cookies', 'session.use_only_cookies', ]; $tmp = []; foreach ($params as $key => $value) { $tmp[$value] = ini_get($value); } print_r($tmp); 
    • Array ([session.auto_start] => 0 [session.name] => PHPSESSID [session.save_path] => / var / lib / php / session [session.gc_maxlifetime] => 1440 [session.cookie_lifetime] => 0 [ session.cookie_path] => / [session.cookie_domain] => [session.cookie_secure] => [session.cookie_httponly] => [session.use_cookies] => 1 [session.use_only_cookies] => 1) - Igor
    • And on the second? Are there any differences? - Ninazu