|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: RQuadling at GMail dot com
New email:
PHP Version: OS:


 [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-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC