Bug #77326 [Opn->Wfx]: ReflectionClass::getReflectionConstant() returns false instead of exception

From: Date: Sat, 22 May 2021 09:11:51 +0000
Subject: Bug #77326 [Opn->Wfx]: ReflectionClass::getReflectionConstant() returns false instead of exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233965@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77326&edit=1 ID: 77326 Updated by: krakjoe@php.net Reported by: me at vasekpurchart dot cz Summary: ReflectionClass::getReflectionConstant() returns false instead of exception -Status: Open +Status: Wont fix Type: Bug Package: Reflection related PHP Version: 7.2 Block user comment: N Private report: N New Comment: Because of the broken bc, this was rejected on the PR. Previous Comments: ------------------------------------------------------------------------ [2018-12-27 03:24:28] The following pull request has been associated: Patch Name: Fixed bug #77326 (ReflectionClass::getReflectionConstant() returns false instead of exception) On GitHub: https://github.com/php/php-src/pull/3721 Patch: https://github.com/php/php-src/pull/3721.patch ------------------------------------------------------------------------ [2018-12-20 13:52:19] me at vasekpurchart dot cz Description: ------------ ReflectionClass::getReflectionConstant() returns false when constant is not found. This is unexpected because all other methods like getMethod() or getProperty() which have equivalent signatures and fuction throw a ReflectionException. The return value is also not documented. Test script: --------------- ``` <?php class Foo {} $barClassReflection = new ReflectionClass(Foo::class); var_dump($barClassReflection->getReflectionConstant('XXX')); ``` https://3v4l.org/k09Q8 Expected result: ---------------- Throw exception like the other methods on ReflectionClass to behave consistently and document this behavior. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77326&edit=1

« previous php.bugs (#233965) next »