#34299 [NEW]: ReflectionClass::isInstantiable() returns true for abstract classes

From: Date: Mon, 29 Aug 2005 21:16:21 +0000
Subject: #34299 [NEW]: ReflectionClass::isInstantiable() returns true for abstract classes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84149@lists.php.net to get a copy of this message
From: dennis at inmarket dot lviv dot ua Operating system: WinXP PHP version: 5.1.0RC1 PHP Bug Type: Class/Object related Bug description: ReflectionClass::isInstantiable() returns true for abstract classes Description: ------------ ReflectionClass::isInstantiable() returns true for abstract classes. Of course, subsequent call to ReflectionClass::newInstance() fails. Please note: this is not the same as bug #28895 (which claims to be solved) - that bug submitter stressed that isAbstract always returns false. In this case, isAbstract returns true, but the isInstantiable also returns true. Reproduce code: --------------- <? abstract class X {} $rc = new ReflectionClass('X'); echo $rc->isAbstract() ? 'yes' : 'no', "\n"; if($rc->isInstantiable()) { echo "Class X is instantiable"; $x = $rc->newInstance(); } else { echo "Cannot instantiate abstract class"; } ?> Expected result: ---------------- yes Cannot instantiate abstract class Actual result: -------------- yes Class X is instantiable Fatal error: Cannot instantiate abstract class X in /path/to/abstract.php on line 9 -- Edit bug report at http://bugs.php.net/?id=34299&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34299&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34299&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34299&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34299&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34299&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34299&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34299&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34299&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34299&r=support Expected behavior: http://bugs.php.net/fix.php?id=34299&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34299&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34299&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34299&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34299&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34299&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34299&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34299&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34299&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34299&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34299&r=mysqlcfg

« previous php.bugs (#84149) next »