#32177 [NEW]: ReflectionException

From: Date: Thu, 03 Mar 2005 15:29:25 +0000
Subject: #32177 [NEW]: ReflectionException
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74793@lists.php.net to get a copy of this message
From: pawel dot kozlowski at gmail dot com Operating system: Any PHP version: 5.0.3 PHP Bug Type: Feature/Change Request Bug description: ReflectionException Description: ------------ I’m trying to use Reflection API. I works great, but I’ve some remarks regarding ReflectionException. Calling ReflectionParameter::getClass() will raise an exception when class definition isn’t already included. That’s fine, it’s an expected behavior. The problem is that I have no way to get the missing class name. Ok, I could parse message string, but this way it becomes (unintentionally) part of the public API. What do You think about having sth like Class ReflectionExceptionClassNotDefined extends ReflectionException { public string getClassName(); } Reproduce code: --------------- class A { public function __construct(B $b) { $this->b = $b; } } $rc = new ReflectionClass('A'); $rconstr = $rc->getConstructor(); $rparams = $rconstr->getParameters(); try { $paramclass = $rparams[0]->getClass(); } catch (ReflectionException $e) { //no way to get 'B' name here, without parsing msg string } -- Edit bug report at http://bugs.php.net/?id=32177&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32177&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32177&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32177&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32177&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32177&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32177&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32177&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32177&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32177&r=support Expected behavior: http://bugs.php.net/fix.php?id=32177&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32177&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32177&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32177&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32177&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32177&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32177&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32177&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32177&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32177&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32177&r=mysqlcfg

« previous php.bugs (#74793) next »