|  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
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: 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-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 04:01:30 2024 UTC