php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33632 cannot use "Subject" as classname
Submitted: 2005-07-10 18:51 UTC Modified: 2005-07-10 19:07 UTC
From: akorthaus at web dot de Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.0b2 OS: Linux 2.4.31 (gentoo)
Private report: No CVE-ID: None
 [2005-07-10 18:51 UTC] akorthaus at web dot de
Description:
------------
I have a class called "Subject" which I use for a long time now, but when I tried to use the code with 5.1b2 I got:

Fatal error: Cannot redeclare class subject...

Simple renaming the class to MailSubject fixes the problem. But I did not redeclare this class, I did a search like "grep -ir subject *"

I tried some test-scrips:

<?php
var_dump(class_exists('Subject'));
?>

bool(false)


<?php
Test {}
class Subject {
}
?>
Fatal error: Cannot redeclare class subject in /var/www/localhost/htdocs/subject.php on line 3


<?php
Test {}
class Subject extends Test {
}
?>

Fatal error: Cannot redeclare class subject in /var/www/localhost/htdocs/subject.php on line 4


(If I extend, error is found in line 4, not 3 ?!). I'm using Apache-sapi with Apache 1.3.33.

Reproduce code:
---------------
<?php
class Subject {}
?>

Expected result:
----------------
empty page

Actual result:
--------------
Fatal error: Cannot redeclare class subject in /var/www/localhost/htdocs/subject.php on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-10 19:07 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

There is an _interface_ \"Subject\" in SPL. 
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu May 14 18:00:01 2026 UTC