|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-07 16:21 UTC] felipe@php.net
[2009-02-07 18:22 UTC] php at kennel17 dot co dot uk
[2009-02-07 18:54 UTC] colder@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 17:00:01 2025 UTC |
Description: ------------ The new get_called_class() function returns the wrong class name when called from within a static method, when that function is called from an instantiated class method. Reproduce code: --------------- <?php class MyClass { function GetClassName() { return get_called_class(); } } class OtherClass { function Foo() { return MyClass::GetClassName(); } } $c = new OtherClass; print( MyClass::GetClassName() . "\n"); print( OtherClass::Foo() . "\n"); print( $c->Foo() . "\n"); ?> Expected result: ---------------- MyClass MyClass MyClass Actual result: -------------- MyClass MyClass OtherClass