#36091 [Com]: getopt() returns false on every call

From: Date: Mon, 30 Jan 2006 16:11:14 +0000
Subject: #36091 [Com]: getopt() returns false on every call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92652@lists.php.net to get a copy of this message
ID: 36091 Comment by: ale at FreeBSD dot org Reported By: oli at isnic dot is Status: Open Bug Type: CGI related Operating System: FreeBSD 5.4 PHP Version: 5.1.2, 4.4.2 New Comment: You can close this bug, I've fixed it in the FreeBSD cvs. Previous Comments: ------------------------------------------------------------------------ [2006-01-30 14:58:38] tony2001@php.net Be sure, I've read man getopt before asking you a _question_: "why does it work without optreset while the docs *require* both optreset and optind to be used?". But you appear to be not very interested in answering the question (or is it a BSD bug?), instead you prefer to keep offending me with your attitude. That makes me wonder why do I care about problem that doesn't bite me in any way? If you're care so much about "bug reports from FreeBSD users tagged as bogus or simply ignored" - provide a patch, cause I'm not going to spend my spare time on it anymore. Thank you. ------------------------------------------------------------------------ [2006-01-30 14:26:16] ale at FreeBSD dot org If you actually read my comments you would have understood that you have to set *both* optind and optreset to '1' before each call. Saying it works only by setting optind to '1' is a clear example of bad code: it's *not* the right way to do. ------------------------------------------------------------------------ [2006-01-30 12:13:24] oli at isnic dot is optreset works for me on FreeBSD just as optind does when set to 1 and not 0 as it is done now in php. ------------------------------------------------------------------------ [2006-01-30 11:04:28] tony2001@php.net Changing both optind & optreset to 1 does the same as changing only optind to 1. I.e. multiple calls to getopt() return expected result after this change. This code apparently doesn't exist in any branches, because I had no chance to test it on Solaris and AIX yet. ------------------------------------------------------------------------ [2006-01-30 10:56:37] oli at isnic dot is I don't see any reference to optreset in the php4 code I have so I assume that you are testing something locally, are you trying to set optreset to 0 or 1, since 1 should be the correct value. ------------------------------------------------------------------------ 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/36091 -- Edit this bug report at http://bugs.php.net/?id=36091&edit=1

« previous php.bugs (#92652) next »