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
 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 12:42 UTC] jani@php.net
-Package: Feature/Change Request +Package: *General Issues
 [2024-06-29 05:52 UTC] mike458joshep at gmail dot com
This post offers a fresh perspective on an important topic. Great job highlighting key points and engaging the audience! (https://github.com)(https://www.spotify-pie.com)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 16:01:29 2024 UTC