Bug #77618 [NEW]: get_class_function() reports wrong class name in parent:: context

From: Date: Thu, 14 Feb 2019 09:03:47 +0000
Subject: Bug #77618 [NEW]: get_class_function() reports wrong class name in parent:: context
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219571@lists.php.net to get a copy of this message
From: llmll at gmx dot de Operating system: All PHP version: 7.2.15 Package: Arrays related Bug Type: Bug Bug description:get_class_function() reports wrong class name in parent:: context Description: ------------ The function get_class_function() should always return the class name of the context in which it is called. Dynamic or Static context should make no difference. When wrapped in a parent:: call it returns the child's class name not the parent's one. Test script: --------------- class A { public static function Name() { return get_called_class(); } } class B extends A { public static function NameOfParent() { return parent::Name(); } } echo B::Name(); echo B::NameOfParent(); Expected result: ---------------- should report "B" as Name() and "A" as NameOfParent(). Actual result: -------------- return "B" twice, because parent doesn't change the context from B:: to A:: as it should. -- Edit bug report at https://bugs.php.net/bug.php?id=77618&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77618&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77618&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77618&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77618&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77618&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77618&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77618&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77618&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77618&r=support Expected behavior: https://bugs.php.net/fix.php?id=77618&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77618&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77618&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77618&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77618&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77618&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77618&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77618&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77618&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77618&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77618&r=mysqlcfg

« previous php.bugs (#219571) next »