ID:               36091
 Comment by:       ale at FreeBSD dot org
 Reported By:      oli at isnic dot is
 Status:           Assigned
 Bug Type:         CGI related
 Operating System: FreeBSD 5.4
 PHP Version:      5.1.2, 4.4.2
 Assigned To:      tony2001
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[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] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[2006-01-30 10:34:48] [EMAIL PROTECTED]

I didn't investigate it either, so if you want to do something useful
for FreeBSD users - please let us know why changing optreset doesn't
affect getopt() (of course, if you're not too tired).

------------------------------------------------------------------------

[2006-01-29 20:45:40] ale at FreeBSD dot org

I'm not whining, I'm just tired, very tired to see bug reports from
FreeBSD users tagged as bogus or simply ignored because they are using
the port system of an "unsupported" platform when they are clearly PHP
bugs. You (and this time I mean exactly you, Derick) about two years
ago said to a FreeBSD user to stop sending "make test" reports because
he was using a "non official version of PHP". Since FreeBSD is the most
used *NIX platform with PHP after Linux I would expect more courtesy
from you (all) with our users.

Returning to this bug, the correct way to re-use getopt on *all* BSD
platforms is to reset optind *and* optreset to '1' before every call.
The last comment in the 35594 report says there might be another bug,
but I didn't investigate further.

------------------------------------------------------------------------

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

Reply via email to