#43313 [Tbd->Csd]: getopt() doesn't handle unknown parameters
ID: 43313
Updated by: kalle@php.net
Reported By: RQuadling at GMail dot com
-Status: To be documented
+Status: Closed
Bug Type: Documentation problem
Operating System: *
PHP Version: 5CVS-2008-11-11
New Comment:
Lets close this, if the need for a third parameter for getopt() is
there, then post a FR instead :)
Previous Comments:
------------------------------------------------------------------------
[2009-12-17 12:13:02] seld@php.net
Disregard last commit message, I forgot to change the bug number sorry.
------------------------------------------------------------------------
[2009-12-17 12:10:37] svn@php.net
Automatic comment from SVN on behalf of seld
Revision: http://svn.php.net/viewvc/?view=revision&revision=292247
Log: Fixes SQL query in example #2 of mysql_stat, fixes bug #43313
------------------------------------------------------------------------
[2009-12-16 22:42:37] j dot boggiano at seld dot be
I fixed this as far as the doc is concerned, but I still agree that
having a third "array &$rest" argument would be useful. I'll let others
decide whether this ought to be closed or not.
------------------------------------------------------------------------
[2009-12-16 22:40:17] svn@php.net
Automatic comment from SVN on behalf of seld
Revision: http://svn.php.net/viewvc/?view=revision&revision=292224
Log: Adds a note about unknown parameters ending getopt() parsing,
fixes bug #43313
------------------------------------------------------------------------
[2009-04-01 13:44:15] rquadling@php.net
The main problem is that you don't get any feedback to say that
userland getopt() HAS encountered an unknown parameter.
If you have supplied a set of parameters to getopt() and one is
mistyped at the command line, you only get the valid ones to the left
of the mistyped one.
I'm happy that that array returned should only contain valid
parameters.
What I would like to have is the broken parameter and any remaining
parameters to be returned as an additional array.
Ideally, skipping broken parameters, but I think that would actually
cause more headaches.
Having to process $argc manually to determine if all the supplied
parameters have been parsed appropriately completely negates the use
of getopt().
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/43313
--
Edit this bug report at http://bugs.php.net/?id=43313&edit=1
Thread (5 messages)