This is an interesting issue I've encountered dealing with a large (20+) Object Library I've created with PHP.
The library works in 2 ways:
1) Modular
2) Standard Page
In Modular Mode, your custom scripts are loaded within the super class object which allocates and addresses the other 20 objects for you. This allows you to call their member functions as "$this"
so you could say: $result = $this->DBI($SQL); and access the database object from any member object as if it were local to it.
Great, nifty... allright.
So here's where it get's weird...
In Standard Page mode, you load the super class into your PHP page and you operate OUTSIDE of it, just like you normally would operate with a class. But here's the funky part...
The object DISSAPEARS from the scope.
It's no where to be found and instead makes all loaded objects local to you, that is, you could call them like the super class would (by instance name), but if you try calling them via the super class, you'll get an error about a method of a non-object.
And moreover... you can no longer call the super classes methods, because once again... it's a non-object. Which is fine, since I don't need it's methods after the initial call.
But even more strange....
When I load another object that isn't built into the super class and declare it an extension of the super class (which says it's a non-object at this point) it runs just fine and works like it normally would, calling member functions of member-objects locally.
AND THE STRANGEST OF ALL....
I can redeclare the object!!!
Check it out....
<?
/////////////////////////////////
include('sitewide/Location.obj');
//here I decalre the super class...
$load = new Location;
$load->Generate(); // after I run this method the object instance dissapears.
////////////////////////////////
// I load this object which EXTENDS the above object
include('action/coverageMan.obj');
$coverage = new coverageMan;
//that SHOULD have generated an error about required inheretance
// now I REDECLARE the first object
$load = new Location;
?>
And not a care in the world.
Really, this shouldn't be happening.
According to environment rules with PHP and having user methods and OOP rules for inheretance, none of this makes sense.
It all seems strange, but it works great so I'm not complaining. Anyone else seen anything like this when dealing with objects?