From:             [EMAIL PROTECTED]
Operating system: windows
PHP version:      4.3.0
PHP Bug Type:     Class/Object related
Bug description:  $this pointer not always pointing to the right object

hi,
i found that the $this pointer does not always point to the current class,
as it is supposted to.

run the following example code:
-----
class ca
{
        function debug()
        {
                echo("ca::debug -> ");
                print_r($this);
                echo("<br>");
        }
}

class cb
{
        function debug()
        {
                echo("cb::debug -> ");
                print_r($this);
                echo("<br>");
        }
        
        function test()
        {
                cb::debug();
                ca::debug();
        }
}

$b = new cb;
$b->test();
-----

output is:
cb::debug -> cb Object ( ) 
ca::debug -> cb Object ( ) 

but should'nt it be:
cb::debug -> cb Object ( ) 
ca::debug -> ca Object ( ) 

it seems that when a class is called like class::methode from within
another class, the this pointer points to the calling class, not the
current running class!!
-- 
Edit bug report at http://bugs.php.net/?id=21486&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21486&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21486&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21486&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21486&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21486&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21486&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21486&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21486&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21486&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21486&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21486&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21486&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21486&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21486&r=gnused

Reply via email to