From: Operating system: Windows XP PHP version: 5.2.13 Package: Class/Object related Bug Type: Bug Bug description:cannot define a class with the same name as an interface
Description:
------------
When I try to define a particular class it fails with "cannot redeclare
class ...". When I check with class_exists('...') it returns false, but I
still cannot create it. I eventually found some previous code which uses
the same name to define an interface.
Test script:
---------------
Interface Singleton{public static function instance();}
if (class_exists('Singleton')) {
$reason = 'class already exists';
} else {
class Singleton{
static function getInstance(){
return true;
}
}
}
Expected result:
----------------
If it is not possible to define a class and an interface with the same
name, then the class_exists() function should also include interface
names.
If it IS possible to have a class and an interface with the same name, then
the compiler should NOT reject the second reference.
--
Edit bug report at http://bugs.php.net/bug.php?id=51225&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51225&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51225&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51225&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51225&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51225&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51225&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51225&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51225&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51225&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51225&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51225&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51225&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51225&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51225&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51225&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51225&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51225&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51225&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51225&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51225&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51225&r=mysqlcfg
