|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59041 Don't use reseved method names
Submitted: 2010-01-23 03:06 UTC Modified: 2010-04-20 08:15 UTC
From: niko dot sams at gmail dot com Assigned: cataphract (profile)
Status: Closed Package: rar (PECL)
PHP Version: 5.2.11 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: niko dot sams at gmail dot com
New email:
PHP Version: OS:


 [2010-01-23 03:06 UTC] niko dot sams at gmail dot com
The following method uses a php construct as name:

Please consider changing the name to avoid problems.

(similar report:

Reproduce code:
class MyClient extends RarArchive
    public function list()

Expected result:
I'd like to override the list method

Actual result:
I get a parse error from php


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-23 05:07 UTC] glopes at nebm dot ist dot utl dot pt
Thank you for your report.

As you point out, naming the method "list" was probably not a very good idea, however, RarArchive is a final class (and consequently your example is inapplicable) and I'm reluctant to change the API at this RC stage.

If, in the future, RarArchive is to become non-final, one can always make list() final and introduce a new method, called by list(), that is overridable. 

So unless there are other cases wherein giving a reserved name to a method will cause problems, I'm marking this Wont fix.
 [2010-01-23 05:25 UTC] niko dot sams at gmail dot com
The real reason why I'm reporting this, is because in KDevelop Php Language Support we generate a php file containing real php code with empty skeletons for all internal php functions and classes. And that file we parse using our parser to use it for code completion.
And our parser fails on this "list" function names - as the real php parser would.
Currently we have this class on a blacklist and can't provide code completion for it.
 [2010-01-23 10:54 UTC]
All right, I've reconsidered.

I've seen such stubs in other IDEs, such as NetBeans. There may be other places (present or future) in which using reserved words for method names are a problem, and this time is the last opportunity to keep them out of a stable API, so I'll be renaming RarArchive::list as RarArchive::getEntries as of 2.0.0 final.
 [2010-01-23 11:50 UTC] niko dot sams at gmail dot com
great, thanks.
 [2010-04-20 08:15 UTC]
Fixed in revision #298209.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 19:01:30 2024 UTC