Bug #81681 [NEW]: ReflectionEnum throwing exceptions

From: Date: Wed, 01 Dec 2021 03:21:16 +0000
Subject: Bug #81681 [NEW]: ReflectionEnum throwing exceptions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238072@lists.php.net to get a copy of this message
From:             brucekwells at gmail dot com
Operating system: Windows 10 build 19043.1348
PHP version:      8.1.0
Package:          Reflection related
Bug Type:         Bug
Bug description:ReflectionEnum throwing exceptions

Description:
------------
ReflectionEnum::isInstantiable returns true (should return false)
ReflectionEnum::isCloneable throws exception (should return false)

Probably other issues, but ran into these first, which are obviously
wrong. All methods in ReflectionEnum inherited from ReflectionClass
should return reasonable values for an enum.

Test script:
---------------
Status.php:
enum Status
{
    case Draft;
    case Published;
    case Archived;
}

Test script:

include 'yourautoloader.php';

$reflectionClass = new \ReflectionEnum('\Status');
echo $reflectionClass->isInstantiable();
echo "\n";
echo $reflectionClass->isCloneable();


Expected result:
----------------
0
0

Actual result:
--------------
1

Fatal error: Uncaught Error: Cannot instantiate enum Status ....

-- 
Edit bug report at https://bugs.php.net/bug.php?id=81681&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81681&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81681&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81681&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81681&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81681&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81681&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81681&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81681&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81681&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81681&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81681&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81681&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81681&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81681&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81681&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81681&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81681&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#238072) next »