Bug #12622: scope of $this and static functions

From: Date: Tue, 07 Aug 2001 15:00:57 +0000
Subject: Bug #12622: scope of $this and static functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-62419@lists.php.net to get a copy of this message
From:             jh@synergy.cx
Operating system: linux 2.2
PHP version:      4.0.6
PHP Bug Type:     Class/Object related
Bug description:  scope of $this and static functions

When calling a static function from within another
class the $this - reference is not empty, but it points
to the class in which you call the static function. To
illustrate:

class Static
{ function method()
  { echo get_class($this);
  }
}

class Container
{ function Container()
  { Static::method();
  }
}

$Container = new Container();

The output is "Container", but there shouldn't be a reference, because it's
not anymore the scope of the
reference.
-- 
Edit bug report at: http://bugs.php.net/?id=12622&edit=1



Thread (2 messages)

« previous php.dev (#62419) next »