I'm using PyroCMS with PHP 5.4.15 in my development server, so I installed a new module (created by someone else) and get this warning all the time:
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: admin/newsletters.php
Line Number: 63
This is the line 63:
$this->data->pagination = create_pagination('admin/newsletters/index', $total_rows);
So reading at PHP doc and Google seems to the var $this->data
isn't initialized so in the constructor of the clase I declared as follow:
public function __construct() {
parent::__construct();
$this->data = "";
}
But the error still appearing, so my question are:
- What's wrong in my solution?
- If I declare or define a var in the class constructor this var is initialized or not? (this is the related OOP part)