Bug #77326 [NEW]: ReflectionClass::getReflectionConstant() returns false instead of exception

From: Date: Thu, 20 Dec 2018 13:52:19 +0000
Subject: Bug #77326 [NEW]: ReflectionClass::getReflectionConstant() returns false instead of exception
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218529@lists.php.net to get a copy of this message
From: me at vasekpurchart dot cz Operating system: PHP version: 7.3.0 Package: Reflection related Bug Type: Bug Bug description:ReflectionClass::getReflectionConstant() returns false instead of exception 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 bug report at https://bugs.php.net/bug.php?id=77326&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77326&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77326&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77326&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77326&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77326&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77326&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77326&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77326&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77326&r=support Expected behavior: https://bugs.php.net/fix.php?id=77326&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77326&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77326&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77326&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77326&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77326&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77326&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77326&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77326&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77326&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77326&r=mysqlcfg

« previous php.bugs (#218529) next »