#43313 [Tbd]: getopt() doesn't handle unknown parameters

From: Date: Thu, 17 Dec 2009 12:13:03 +0000
Subject: #43313 [Tbd]: getopt() doesn't handle unknown parameters
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3499@lists.php.net to get a copy of this message
ID: 43313 Updated by: seld@php.net Reported By: RQuadling at GMail dot com Status: To be documented Bug Type: Documentation problem Operating System: * PHP Version: 5CVS-2008-11-11 New Comment: Disregard last commit message, I forgot to change the bug number sorry. Previous Comments: ------------------------------------------------------------------------ [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(). ------------------------------------------------------------------------ [2009-04-01 11:34:32] jani@php.net Let's stick with the POSIX way. And document it as is. ------------------------------------------------------------------------ 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

« previous php.doc.bugs (#3499) next »