Php_Incomplete_Class Issue

Hi folks,

I inherited a Yii project that is working on a production server but I am seeing a mysterious error locally. I need help.

This is the error:

Fatal error: Cannot use object of type __PHP_Incomplete_Class as array in /var/www/myapp/app/protected/controllers/NotificationController.php on line 144

The culprit seems to be that the previous developer is trying to access an array value like this:

$user = $this->getLoginUser();


The file private/components/Controller.php is defining getLoginUser() with this method:

    public function setLoginUser() {

        $this->loginUser = Yii::app()->session['primaryLoginUser'];


The problem is that if I try to print_r $user I get the following PHP Incomplete Class Object.

__PHP_Incomplete_Class Object


    [__PHP_Incomplete_Class_Name] => users

    [_md:CActiveRecord:private] => 

    [_new:CActiveRecord:private] => 

    [_attributes:CActiveRecord:private] => Array


            [id] => 1

            [role_id] => 1

            [profile_pic_name] => 

            [first_name] => Admin

            [last_name] => Admin


    [_related:CActiveRecord:private] => Array



    [_c:CActiveRecord:private] => 

    [_pk:CActiveRecord:private] => 1

    [_alias:CActiveRecord:private] => t

    [_errors:CModel:private] => Array



    [_validators:CModel:private] => 

    [_scenario:CModel:private] => update

    [_e:CComponent:private] => 

    [_m:CComponent:private] => 


So, how is it possible he is getting the value as an array in the production server? I can’t even get it with $user->role_id. Help?

I am using Ubuntu 14.04 with Nginx. Attached is my 5749


Maybe this can help:

You should check for Yii class autoloading, or for some path configuration that are not being able to declare User class before the framework retrieves it from session.


The previous developer had a mix of lower and upper case declarations for the Users model. Sometimes they used Users::model()->method(); and sometimes it was users::model()->method(). Notice the difference in casing for the u in users.

To make matters worse, the class was defined as class users extends CActiveRecord, in lowercase, while the file was saved as uppercase. Thus, I assume Yii had difficulty autoloading the file. Clearly by switching from a Windows to a Linux environment, letter casing became an issue.

Thanks Newton for your reply. It was the hint that fueled me to check the Users model. :)