At the top of one class I declare a security object:
var $securityObject = null;
In the constructor, I initialize a bunch of member objects. Because
I've had trouble with the security object, I also test to make sure it
has been initialized:
function IntfCommands() {
parent::IntfBas ic();
$this->resultsObjec t->notes("We are now at the beginning of the
constructor for IntfCommands.") ;
$this->pageInfoObje ct = & $this->core->getObject("McP ageInfo", "
IntfCommands");
$this->selectObject = & $this->core->getObject("Ext eriorSelect",
"IntfCommands") ;
$this->arrangementsOb ject = &
$this->core->getObject("McA rrangements", "IntfCommands") ;
$this->validationObje ct = &
$this->core->getObject("Ext eriorValidation ", "IntfCommands") ;
$this->userObject = & $this->core->getObject("McU sers",
"IntfCommands") ;
$this->optionsObjec t = & $this->core->getObject("Sin gletonOptions",
"IntfCommands") ;
$this->fetchObject = & $this->core->getObject("Ext eriorFetch",
"IntfCommands") ;
$this->securityObje ct = & $this->core->getObject("Ext eriorSecurity",
"IntfCommands") ;
$this->outputObject = & $this->core->getObject("Ext eriorOutput",
"IntfCommands") ;
$this->fileObject = & $this->core->getObject("Ext eriorFile",
"IntfCommands") ;
if (is_object($thi s->fileObject)) {
$this->fileObject->setFileObject( "pathAccess ");
} else {
$this->resultsObjec t->error("In the constructor of IntfCommands we
could not get an instance of ExteriorFile.", "IntfCommands") ;
}
if (!is_object($th is->validationObje ct)) {
$this->resultsObjec t->error("In the constructor of IntfCommands, we
were unable to get the ExteriorValidat ion object.", "IntfCommands") ;
}
if (!is_object($th is->securityObject )) {
$this->resultsObjec t->error("In the constructor of IntfCommands, we
were unable to get the ExteriorSecurit y object.", "IntfCommands") ;
}
$this->resultsObjec t->notes("We are now at the end of the constructor
for IntfCommands.") ;
}
The error never shows up. And yet, later on, when I call a class
method, I get the error that says there is no security object:
function testSecurity($c ommand=false) {
if ($command) {
if (is_object($thi s->securityObject )) {
$this->securityObje ct->setSecurityObj ect("CheckComma ndSecurity");
$isThisSecure = $this->securityObje ct->check($command );
return $isThisSecure;
} else {
$this->core->error("In testSecurity(), in IntfCommands, there was
no security object, so we could not test the security for command
'$command'.", "IntfCommands") ;
}
} else {
$this->resultsObjec t->error("In testSecurity(), in IntfCommands, we
expected to be given a command name, but we were not.",
"IntfCommands") ;
return false;
}
}
So this object passes the is_object() test up in the constructor, but
then fails later on when the method is called.
What kinds of things might destroy that object in between? What should
I look for in my code. I already ran a search for unset() but got
nothing.