Bug #70294 [NEW]: ReflectionException getCode should return a non-zero code
From: mattsch at gmail dot com
Operating system: Gentoo
PHP version: 5.6.12
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionException getCode should return a non-zero code
Description:
------------
When a ReflectionException is thrown for any reflection class, an
exception code is not set (i.e. it always returns 0). This makes it
quite difficult to identify what caused the exception. As a result, I
am forced to parse the exception message to determine what went wrong
instead of relying on a constant from the getCode method.
Test script:
---------------
<?php
try {
$reflectionFunction = new ReflectionFunction('foo');
} catch(Exception $e){
var_dump($e->getCode());
}
Expected result:
----------------
A non-zero code.
Actual result:
--------------
int(0)
--
Edit bug report at https://bugs.php.net/bug.php?id=70294&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70294&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70294&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70294&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70294&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70294&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70294&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70294&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70294&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70294&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70294&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70294&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70294&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70294&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70294&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70294&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70294&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70294&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70294&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70294&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70294&r=mysqlcfg
Thread (3 messages)
- mattsch at gmail dot com