Non object Error?
Date: 12/14/07
(PHP Community) Keywords: tracker
I have this in one of my object classes.
static $errorTracker = NULL;
public function __construct(){
$this->errorTracker = ErrorTracker::getInstance();
}
protected function _isError($error){
return $this->errorTracker->_isError($error);
}
And in the ErrorTracker class,
public static function getInstance (){
static $instance;
if (!isset($instance)){
$c = __CLASS__;
$instance = new $c;
}
return $instance;
}
When this is run, I get:
Fatal error: Call to a member function _isError() on a non-object
Any idea why the ErrorTracker is falling out of scope? Thanks.
Source: http://community.livejournal.com/php/603569.html