php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51664 Interfaces page gives unclear information about class constants
Submitted: 2010-04-26 11:08 UTC Modified: 2010-04-26 18:50 UTC
From: chris at cmbuckley dot co dot uk Assigned: degeberg (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: chris at cmbuckley dot co dot uk
New email:
PHP Version: OS:

 

 [2010-04-26 11:08 UTC] chris at cmbuckley dot co dot uk
Description:
------------
There are two cases on the interfaces documentation page that give misleading information about class constants, by saying that interface constants have the same behaviour as class constants in that they cannot be overridden by an inheriting class. This is true of interfaces, but not of classes.

The offending text appears in the "Constants" section (http://php.net/interfaces#language.oop5.interfaces.constants) and in the comments in Example #4.

Test script:
---------------
class a { const t = 'foo'; }
class b extends a { const t = 'bar'; }
echo b::t; // 'bar'



interface i { const t = 'foo'; }
class c implements i { const t = 'bar'; } // Fatal: cannot override




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-26 18:26 UTC] degeberg@php.net
Automatic comment from SVN on behalf of degeberg
Revision: http://svn.php.net/viewvc/?view=revision&revision=298601
Log: Fixed PHP bug #51664 (Interfaces page gives unclear information about class constants)
 [2010-04-26 18:27 UTC] degeberg@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: degeberg
 [2010-04-26 18:27 UTC] degeberg@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2010-04-26 18:32 UTC] chris at cmbuckley dot co dot uk
Initial fix addresses documentation text but the following comment in Example #4 still remains:

// This will however not work because its not allowed to 
// override constants. This is the same concept as with 
// class constants

IMHO this still leaves room for confusion.
 [2010-04-26 18:50 UTC] degeberg@php.net
Automatic comment from SVN on behalf of degeberg
Revision: http://svn.php.net/viewvc/?view=revision&revision=298604
Log: Another fix for #51664 (Interfaces page gives unclear information about class constants)
 [2010-04-26 18:50 UTC] degeberg@php.net
Oh, sorry. I hadn't noticed that comment. That sentence has been removed now.

Thanks again :)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 07:00:01 2026 UTC