From:             [EMAIL PROTECTED]
Operating system: Linux 2.2
PHP version:      4.0.4pl1
PHP Bug Type:     Scripting Engine problem
Bug description:  Static classes sometimes have a $this pointer

If you call a static method from within an object, the static method will inherit the 
$this pointer of the calling object. This script demonstrates the problem:



class StaticClass {
    function doSomething() {
        echo $this->data;

class Instantiated {
    var $data;

    function Instantiated($data) {
        $this->data = $data;

$ob = new Instantiated('foo');


This is rather confusing behavior - $this should be out of scope inside static methods 
no matter what.

Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to