#32603 [NEW]: there is no easy way to check if class implements some interface

From: Date: Wed, 06 Apr 2005 06:56:46 +0000
Subject: #32603 [NEW]: there is no easy way to check if class implements some interface
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76761@lists.php.net to get a copy of this message
From: indeyets at gmail dot com Operating system: PHP version: 5.0.4 PHP Bug Type: Feature/Change Request Bug description: there is no easy way to check if class implements some interface Description: ------------ there is no easy way to check if class implements some interface. This is needed, when, for example, php-application has support for loading external classes. external classes have to implement some interface. And check for this should happen BEFORE object creation. (for example, there might be a need for some specific constructor syntax). PHP 5.0 allows to do the following things: 1). $parent = get_parent_class("SomeClassName"). This would be sufficient, if plugins _extend_ some base class. that's not our case - wouldn't work for interfaces 2). if ($obj instanceof "SomeInterfaceName") {}. This would work, if we could create object before the interface check. Wouldn't work for non-existen objects 3). reflection API. it can do the thing, but overhead (both in code and in resources) is too big -- Edit bug report at http://bugs.php.net/?id=32603&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32603&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32603&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32603&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32603&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32603&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32603&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32603&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32603&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32603&r=support Expected behavior: http://bugs.php.net/fix.php?id=32603&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32603&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32603&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32603&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32603&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32603&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32603&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32603&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32603&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32603&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32603&r=mysqlcfg

« previous php.bugs (#76761) next »