#50200 [NEW]: get_class() is not the same as get_class($this)

From: Date: Tue, 17 Nov 2009 08:47:44 +0000
Subject: #50200 [NEW]: get_class() is not the same as get_class($this)
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3195@lists.php.net to get a copy of this message
From: sjoerd-php at linuxonly dot nl Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: get_class() is not the same as get_class($this) Description: ------------ The documentation on get_class() does not specify what happens when the parameter is omitted. I assumed the parameter defaults to $this, but this is not the case. Note that this may also be a bug in the implementation instead of the documentation. Reproduce code: --------------- <?php class A { function a() { echo get_class(); echo get_class($this); } } class B extends A { } $b = new B(); $b->a(); ?> Actual result: -------------- get_class() in A will return A, where get_class($this) will return B. -- Edit bug report at http://bugs.php.net/?id=50200&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50200&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50200&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50200&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50200&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50200&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50200&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50200&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50200&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50200&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50200&r=support Expected behavior: http://bugs.php.net/fix.php?id=50200&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50200&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50200&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50200&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50200&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50200&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50200&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50200&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50200&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50200&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50200&r=mysqlcfg

« previous php.doc.bugs (#3195) next »