php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47432 Error message for built-in override is very non-obvious
Submitted: 2009-02-18 02:11 UTC Modified: 2014-12-30 10:41 UTC
From: spam at paulisageek dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: * OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-02-18 02:11 UTC] spam at paulisageek dot com
Description:
------------
If you have a c extension defining certain classes, then defining the same class in user land gives the message :

Fatal error: Cannot redeclare class *classname* in *file* on line *linenum*

This is quite confusing, since most people will know to look through all their user land scripts for the redefinition, and few will actually look at their installed extensions to find conflicts.

I recommend changing the error message to:

Fatal error: Cannot redeclare built-in class *classname* in *file* on line *linenum*

Reproduce code:
---------------
<?php

class Exception {
}

?>

Expected result:
----------------
Fatal error: Cannot redeclare built-in class *classname* in *file* on line *linenum*

Actual result:
--------------
Fatal error: Cannot redeclare class *classname* in *file* on line *linenum*

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-08 20:40 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2014-07-13 22:55 UTC] yohgaki@php.net
-Status: Open +Status: Feedback -PHP Version: 5.2.9RC2 +PHP Version: *
 [2014-07-13 22:55 UTC] yohgaki@php.net
This applies to built in and module functions also. 

This bug is reported for 5.2 and we have namespace now. Is this needed? Distinguishing between built in and user defined class does not give us any benefits. Redefinition is redefinition anyway.
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Oct 06 15:05:53 2022 UTC