Answer the question
In order to leave comments, you need to log in
After transferring to a hosting, an error occurs when trying to log in, what could be wrong?
After transferring the site to the hosting, when trying to log in, the following error began to appear:
Declaration of User::updateCounters() should be compatible with CActiveRecord::updateCounters($counters, $condition = '', $params = Array)
What could be cause?
LoginController:
public function actionIndex()
{
if(!user()->isGuest) {
$this->redirect(url('table/index'));
}
$this->layout = '//layouts/login';
$form = new LoginForm();
if(isset($_POST['LoginForm'])) {
$form->attributes = $_POST['LoginForm'];
if ($form->validate()) {
if($form->authenticateUser()) {
$this->redirect(url('table/index'));
}
}
}
$this->render('index', array(
'loginForm' => $form
));
}
public $email;
public $password;
public function rules()
{
return array(
array('email, password', 'required')
);
}
public function attributeLabels()
{
return array(
'email' => 'E-mail',
'password' => 'Пароль'
);
}
public function authenticateUser()
{
$identitiy = new UserIdentity($this->email, $this->password);
if (!$id = $identitiy->authenticate()) {
$this->addError('password', 'Неверный логин или пароль.');
return false;
} else {
user()->login($identitiy);
user()->id = $id;
//добавляем админскую сессию в соотв. таблицу
db()->createCommand()->insert('admin_sessions', array('sessionID'=>session_id()));
return true;
}
}
Answer the question
In order to leave comments, you need to log in
The signature of the updateCounters method of the User model does not match the parent signature described in CActiveRecord.
You need to bring it into (signature) in accordance with the parent.
The local and production environments are different (perhaps: different versions of php or different error output settings (E_ALL ^ E_STRICT)), so the error is not displayed locally (although, most likely, it is also there). This error corresponds to category E_STRICT btw
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question