#50200 [Opn->Bgs]: get_class() is not the same as get_class($this)

From: Date: Tue, 17 Nov 2009 09:14:02 +0000
Subject: #50200 [Opn->Bgs]: get_class() is not the same as get_class($this)
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3196@lists.php.net to get a copy of this message
ID: 50200 Updated by: rquadling@php.net Reported By: sjoerd-php at linuxonly dot nl -Status: Open +Status: Bogus Bug Type: Documentation problem PHP Version: Irrelevant New Comment: Example #2 Using get_class() in superclass clearly covers this. Previous Comments: ------------------------------------------------------------------------ [2009-11-17 08:47:43] sjoerd-php at linuxonly dot nl 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 this bug report at http://bugs.php.net/?id=50200&edit=1

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