[eluser]mark17[/eluser]
L.S.
The following fatal error is what i get in at least CodeIgniter 1.6.1, perhaps it's present in older versions but haven't tried it.
Code:
Fatal error: Cannot access private property Test::$test in /home/markus/public_html/brochureselectie.nl/trunk/sys/libraries/Model.php on line 69
This is produced when some model attempts to set a classvariable with the same name, like the snippet below.
Code:
<?php
class Test extends Model {
private $test = NULL;
public function __construct() {
parent::__construct();
$this->test = 'TEST';
}
public function getTest() {
return $this->test;
}
}
?>
I'm unsure whether or not this is an existing and an already reported bug, although a search for model related issues did not result in any bug alike.
Any thoughts on this one? It should not be a problem to have ambiguous naming within some class. This could also cause dynamically generated errors when some code using __set() methods to dynamically assign new variables to the scope.
Code:
<?php
class Test extends MY_Model {
//private $test = NULL;
public function __construct() {
parent::__construct();
$this->test = 'TEST';
}
public function getTest() {
return $this->test;
}
public function __set($b, $c) {
var_dump($b);
print '<p>';
var_dump($c);
}
}
?>
The last snippet will generate the following output, possibly because __set will catch not only my assignment of $this->test but a lot more internal stuff. Please try...
Regards,