Hello, I want to update my php version to 7.1.2. Actually i have php 7.0.11 and my application works very good but when i update my php to 7.1.2 the application don’t save the session correctly because always dispatch my method afterLogin on my WebUser(inherit of CWebUser) class. Someone have any idea how can i resolve this issue?
Thanks a lot!
<?php
class DWebUser extends CWebUser{
protected function afterLogin($fromCookie){
Yii::log('After LOGIN fromCookie:'.$fromCookie );
$forceLoginDefaultCompany=DOAuth::getForceLoginCompany();
if($forceLoginDefaultCompany){
$this->defaultCompany=$forceLoginDefaultCompany;
}else{
$this->defaultCompany=UsersCompanies::getRoleCompany($this->getId());
}
if($this->defaultCompany){
if(!$this->getState('company')){
$this->setState('company',$this->defaultCompany);
}
if(!$this->getState('companies')){
$this->setState('companies',UsersCompanies::getRoles($this->getId()));
}
if($fromCookie){
$user=Users::model()->findByPk(Yii::app()->user->id);
if($user){
Yii::app()->user->setState('firstname',$user->firstname);
Yii::app()->user->setState('lastname',$user->lastname);
Yii::app()->user->setState('document_number',$user->document_number);
}else{
$this->logout();
}
}
}else{
$this->logout();
Flashes::set('warning',Yii::t('errors','The user don\'t have an published asociated company, Please contact Company administrator.'));
// Yii::app()->controller->redirect($this->loginUrl,false);
return false;
}
}
}