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