From: mark dot 2391 at blueyonder dot co dot uk
Operating system: Debian GNU/Linux
PHP version: 5.2.0
PHP Bug Type: Class/Object related
Bug description: ReflectionClass::implementsInterface() thowing exception
Description:
------------
The ReflectionClass::implementsInterface() correctly returns boolean true
for a given interface the subject class implements, but instead of
returning boolean false for one it does not, a ReflectionException is
thrown instead.
Reproduce code:
---------------
<?php
interface Polite
{
public static function sayHello();
}
class Greeting implements Polite
{
public static function sayHello()
{
echo "Hello<br>\n";
}
}
Greeting::sayHello();
$refl = new ReflectionClass('Greeting');
if ($refl->implementsInterface('Polite')) {
echo "Greeting implements Polite<br>\n";
} else {
echo "Greeting does not implements Polite<br>\n";
}
if ($refl->implementsInterface('Rude')) {
echo "Greeting implements Rude<br>\n";
} else {
echo "Greeting does not implement Rude<br>\n";
}
?>
Expected result:
----------------
Hello
Greeting implements Polite
Greeting does not implement Rude
Actual result:
--------------
Hello
Greeting implements Polite
Fatal error: Uncaught exception 'ReflectionException' with message
'Interface Rude does not exist' in
/home/mim/sites/intranet.home/tech/PHP/static-classes/static-object-usage.php:26
Stack trace: #0
/home/mim/sites/intranet.home/tech/PHP/static-classes/static-object-usage.php(26):
ReflectionClass->implementsInterface('Rude') #1 {main} thrown in
/home/mim/sites/intranet.home/tech/PHP/static-classes/static-object-usage.php
on line 26
--
Edit bug report at http://bugs.php.net/?id=40136&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40136&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40136&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40136&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40136&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40136&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40136&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40136&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40136&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40136&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40136&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40136&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40136&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40136&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40136&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40136&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40136&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40136&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40136&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40136&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40136&r=mysqlcfg