|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #43587 Allow getopt to set False by handling a trailing - on a non-optional parameter.
Submitted: 2007-12-13 12:25 UTC Modified: 2010-11-24 12:42 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: RQuadling at GMail dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 5.3CVS-2007-12-13 (snap) OS: irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
39 - 11 = ?
Subscribe to this entry?

 [2007-12-13 12:25 UTC] RQuadling at GMail dot com
Currently you can you getopt to support the following formats

-p value

-o [value]
--optionalparam [value]

are not supported at the moment.

What I would like to have supported is ...


This would provide a fix for 23859 by allowing you to explicitly state the boolean value rather than relying on the arguable counter-intuitive value returned for boolean tests.

It would also allow you to be able to document default boolean flags and supply a method of disabling them using the same flag rather than having to have an enableflag and a disableflag setting.

If people have been using + or - in there long parameter names, then I suppose this will be a BC for them, but in simple testing it looks like you can't have them in your long opts.



Richard Quadling.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 12:42 UTC]
-Package: Feature/Change Request +Package: *General Issues
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 12:01:29 2024 UTC