The CI community does not seem to have an answer to this (or maybe it is so obvious that it looks like a noob question?), So I ask here.
I have seen this error for a long time (error messages follow), however I always used this "dirty" workaround . Now I no longer want to edit the main CI code, and I know that there must be an elegant solution for this.
Here is the setup.
In my application / config / routes I have this
$route['default_controller'] = "dispatcher";
The Dispatcher class in the application / controllers / is defined as follows:
class Dispatcher extends MY_Controller { function __construct() { parent::__construct(); $this->load->helper(array('form','https')); } function index() {
now MY_Controller is in the application / kernel and is defined as follows:
class MY_Controller extends CI_Controller { public function __construct() { parent::__construct(); $this->GLO = array();
Each model I use runs as follows (named accordingly):
class Map extends CI_Model { function __construct(){ parent::__construct(); } function get_map(){ ..... return true; }
Now that CI 2.1.2, PHP 5.3.3, Apache 2 on Debian when trying to load the page, I get this error:
A PHP error has occurred. Severity: Notification message: indirect change of the overloaded Langs :: $ GLO property does not affect File name: site / langs.php Line number: 82
A PHP error has occurred. Severity: Notification: Undefined Property: Dispatcher :: $ map File name: controllers / dispatcher.php Line Number: 21
Fatal error: call of get_map () member function for non-object in / home / webdev / MC / _WWW / application / controllers / dispatcher.php on line 21
Line 21 - the one noted above in the map model
if ( $mapped = $this->map->get_map() ){
line 82 in another model is as follows:
$this->GLO['langs'][] = $temp;
Throughout the code, this GLO array references $ this-GLO [key]. He needs to be read and written from time to time. If I remove the __set function in MY_Controller, I get more of these warnings.
Where is the problem?
Many thanks!