[php-src] Issue #12271: IntBackedEnum and StringBackedEnum cannot be determined with is_a()

From: Date: Fri, 22 Sep 2023 13:16:22 +0000
Subject: [php-src] Issue #12271: IntBackedEnum and StringBackedEnum cannot be determined with is_a()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245418@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12271 Author: WalterWoshid ### Description The following code: ```php <?php enum MyStringBackedEnum: string { case STRING = "string"; } $string = MyStringBackedEnum::STRING; print_r((is_a($string, \StringBackedEnum::class, true)) ? 'Is a StringBackedEnum': 'Is not a StringBackedEnum'); print_r("\n"); print_r((is_a($string, \BackedEnum::class, true)) ? 'Is a BackedEnum': 'Is not a BackedEnum'); ``` Resulted in this output: ``` Is not a StringBackedEnum Is a BackedEnum ``` But I expected this output instead: ``` Is a StringBackedEnum Is a BackedEnum ``` I see that StringBackedEnum and IntBackedEnum is marked as @internal, but I still need to differentiate between both cases in my library. See https://3v4l.org/6XCOJ ### PHP Version PHP 8.1.0 - 8.1.23, 8.2.0 - 8.2.10 ### Operating System Whatever 3V4L uses, Arch Linux

« previous php.bugs (#245418) next »