#31331 [NEW]: $this behaviour is wrong

From: Date: Wed, 29 Dec 2004 03:30:35 +0000
Subject: #31331 [NEW]: $this behaviour is wrong
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-71201@lists.php.net to get a copy of this message
From: mgkimsal at conduit-it dot com Operating system: mandrake PHP version: 5.0.2 PHP Bug Type: Class/Object related Bug description: $this behaviour is wrong Description: ------------ $this behaviour is wrong... It's showing the context of the calling object instead of its own object (which doesn't exist if called statically). Reproduce code: --------------- <? class myclass { function __construct() { } function __destruct() { } public function bar($foo) { print_r($this); } } class foo { public $prop = 'property'; function docode() { myclass::bar('foo'); } } $f = new foo(); $f->docode(); ?> Expected result: ---------------- I would expect to see nothing, or perhaps info on the mycode class. Actual result: -------------- I see info on the foo class. :( -- Edit bug report at http://bugs.php.net/?id=31331&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31331&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31331&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31331&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31331&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31331&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31331&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31331&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31331&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31331&r=support Expected behavior: http://bugs.php.net/fix.php?id=31331&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31331&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31331&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31331&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31331&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31331&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31331&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31331&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31331&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31331&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31331&r=mysqlcfg

« previous php.bugs (#71201) next »