php.net |  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
Votes:1
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
Have you experienced this issue?
Rate the importance of this bug to you:

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

-t
-p=value
-p value
-o[=value]
--test
--param=value
--optionalparam[=value]

NOTE
-o [value]
--optionalparam [value]

are not supported at the moment.


What I would like to have supported is ...

-t-
-t+
--test-
--test+

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.

Please.

Regards,

Richard Quadling.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 12:42 UTC] jani@php.net
-Package: Feature/Change Request +Package: *General Issues
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC