Fatal error: Access to undeclared static property

Hello friends

I did a project using php 5.3, The project is working well in my machine, but when I put this project in other machine using php 5.6 to test I had this error:

Fatal error: Access to undeclared static property: Controller::$this in /Users/Alexandre/web_projects/empresa_nova/apps_administrator_php_yii/protected/controllers/SiteController.php on line 10

The error refer this line:

parent::$this->scriptJS = array(Yii::app()->request->baseUrl . "/libs/site/site.js");

This is the complete code:




public $scriptJS;

    public $layout = "//layouts/default";


    public function __construct($id) {


        parent::$this->scriptJS = array(Yii::app()->request->baseUrl . "/libs/site/site.js");

        parent::__construct($id);

    }



Whats the problem?

$scriptJS this is current class public property, why yor are assigning it to parent property




    public $scriptJS;

    public $layout = "//layouts/default";


    public function __construct($id) {


        $this->scriptJS = array(Yii::app()->request->baseUrl . "/libs/site/site.js");

        parent::__construct($id);

    }



you doing it wrong you have a syntax error





// change this

parent::$this->scriptJS = array(Yii::app()->request->baseUrl . "/libs/site/site.js");


// like so

$this->scriptJS = array(Yii::app()->request->baseUrl . "/libs/site/site.js");




Thank`s