Bug #81438 [NEW]: ReflectionEnum: Impossible to instantiate in the same way as Classas Class

From: Date: Tue, 14 Sep 2021 20:35:30 +0000
Subject: Bug #81438 [NEW]: ReflectionEnum: Impossible to instantiate in the same way as Classas Class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236603@lists.php.net to get a copy of this message
From: julien dot boudry at gmail dot com Operating system: * PHP version: 8.1.0RC1 Package: *General Issues Bug Type: Bug Bug description:ReflectionEnum: Impossible to instantiate in the same way as Classas Class Description: ------------ This seems to be an inconsistency. The RFC does not say anything about this. The opposite of what happens to a class. Working if testEnum is declared before reflection. Test script: --------------- <?php $objClass = testObject::class; // OK $enumClass = testEnum::class; // OK new \ReflectionClass(testObject::class); // OK new \ReflectionEnum(testEnum::class); // Fatal Error // class testObject {} Enum testEnum { case TEXT; } Expected result: ---------------- No error Actual result: -------------- PHP Fatal error: Uncaught ReflectionException: Class "testEnum" does not exist in test.php:7 Stack trace: #0 test.php(7): ReflectionEnum->__construct() #1 {main} thrown in test.php on line 7 -- Edit bug report at https://bugs.php.net/bug.php?id=81438&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81438&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81438&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81438&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81438&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81438&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81438&r=support Expected behavior: https://bugs.php.net/fix.php?id=81438&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81438&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81438&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81438&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81438&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81438&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81438&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81438&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81438&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81438&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81438&r=mysqlcfg

« previous php.bugs (#236603) next »