|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-04-12 19:37 UTC] mail at pmmaga dot net
[2017-04-12 21:36 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2017-04-12 21:36 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 09:00:01 2025 UTC |
Description: ------------ The return value of get_called_class() is wrong, when it is called from a static method that is called via self::method() in a non-static method. Test script: --------------- <?php class Foo { protected static function getClass() { return get_called_class(); } public function bar() { echo 'Foo: ', Foo::getClass(), "\n"; echo 'self: ', self::getClass(), "\n"; echo 'static: ', static::getClass(), "\n"; } } class Child extends Foo { protected static function getClass() { return 'x'; } } (new Child)->bar(); Expected result: ---------------- Foo: Foo self: Foo static: x Actual result: -------------- Foo: Foo self: Child static: x