Bug #77851 [NEW]: __CLASS__ empty inside function inside class

From: Date: Fri, 05 Apr 2019 04:56:07 +0000
Subject: Bug #77851 [NEW]: __CLASS__ empty inside function inside class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220326@lists.php.net to get a copy of this message
From: requinix Operating system: PHP version: master-Git-2019-04-05 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:__CLASS__ empty inside function inside class Description: ------------ In PHP 5-7.3, using __CLASS__ inside a function defined inside a class would give the name of the containing class. Also true for anonymous classes. https://3v4l.org/uVcPi In 7.4 and master it is an empty string. Test script: --------------- <?php class Example { public function __construct() { function example() { var_dump(__CLASS__); } } } new Example(); example(); ?> Expected result: ---------------- string(7) "Example" Actual result: -------------- string(0) "" -- Edit bug report at https://bugs.php.net/bug.php?id=77851&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77851&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77851&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77851&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77851&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77851&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77851&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77851&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77851&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77851&r=support Expected behavior: https://bugs.php.net/fix.php?id=77851&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77851&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77851&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77851&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77851&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77851&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77851&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77851&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77851&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77851&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77851&r=mysqlcfg

« previous php.bugs (#220326) next »