theEternalStudent2017-03-30 10:45:09
theEternalStudent, 2017-03-30 10:45:09

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?

public function actionIndex()
        if(!user()->isGuest) {

        $this->layout = '//layouts/login';
        $form = new LoginForm();
        if(isset($_POST['LoginForm'])) {
            $form->attributes = $_POST['LoginForm'];
            if ($form->validate()) {
                if($form->authenticateUser()) {

        $this->render('index', array(
            'loginForm' => $form

LoginForm model:
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()->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

1 answer(s)
Nikolai Konyukhov, 2017-03-30

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 question

Ask a Question

731 491 924 answers to any question