From: [EMAIL PROTECTED]
Operating system: WIN2000
PHP version: 4.3.0
PHP Bug Type: Class/Object related
Bug description: Class owners
<?
class class_root
{
var $a;
var $b;
function class_root()
{
echo get_class($this)." Created<br>";
}
}
class db_class extends class_root
{
var $owner;
function db_class($ow)
{
$this->class_root();
$this->owner=$ow;
}
}
class adm_class extends class_root
{
var $owner;
function adm_class($ow)
{
$this->class_root();
$this->owner=$ow;
}
function kkk()
{
echo get_class($this->owner)."<br>";
echo get_class($this->owner->adm)."<br>";//Undefined ??? ... must be
object
echo get_class($this->owner->db)."<br>";//Undefined ??? ... must be
object
$this->owner->adm->kkk();
}
}
class super_class extends class_root
{
var $s;
var $adm;
var $db;
function super_class()
{
$this->class_root();
$this->adm=new adm_class(&$this);
$this->db=new db_class(&$this);
}
}
$sc=new super_class();
$sc->adm->kkk();
echo '-------';
?>
results:
super_class Created
adm_class Created
db_class Created
super_class
Fatal error: Call to a member function on a non-object in
bla-bla-bla\1.php on line 35
PHP works as apache2 module
--
Edit bug report at http://bugs.php.net/?id=21711&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21711&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21711&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21711&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21711&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21711&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21711&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21711&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21711&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21711&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21711&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21711&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21711&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21711&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21711&r=gnused