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

2006-01-30 Thread ale at FreeBSD dot org
 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] [EMAIL PROTECTED]

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



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


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

2006-01-30 Thread ale at FreeBSD dot org
 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


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

2006-01-29 Thread ale at FreeBSD dot org
 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:

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.


Previous Comments:


[2006-01-29 18:13:12] [EMAIL PROTECTED]

@ale: Instead of whining about us doing things wrong on FreeBSD why
don't you give us a patch? This kind of language doesn't make us feel
better about FreeBSD (or its developers).



[2006-01-29 17:53:50] ale at FreeBSD dot org

Please *stop* saying shit, please! Your attitude towards FreeBSD is
just stupid and all your bug database is pervaded by this arrogance;
accusing FreeBSD for your coding deficiencies is incredibly childish.
Even if you think so, Linux is not the OS reference and the 'optreset'
variable existed *before* the birth of Linux and FreeBSD.

This is taken from 4.3BSD:

 The variables opterr and optind are both initialized to 1.  The
optind
 variable may be set to another value before a set of calls to
getopt() in
 order to skip over more or less argv entries.

 In order to use getopt() to evaluate multiple sets of arguments,
or to
 evaluate a single set of arguments multiple times, the variable
optreset
 must be set to 1 before the second and each additional set of
calls to
 getopt(), and the variable optind must be reinitialized.

 The optreset variable was added to make it possible to call the
getopt()
 function multiple times.



[2006-01-24 01:15:43] [EMAIL PROTECTED]

Reassigned to myself.
I'll commit the patch as soon as I figure out if it works on Solaris
and AIX.



[2006-01-20 13:30:34] [EMAIL PROTECTED]

Changing optind re-initalization to optind = 1; fixes it for me on
FreeBSD (and works on Linux).
Though it still makes we wonder why FreeBSD prefers to have its own
implementation of everything: for some reasons they also have `extern
int optreset;`, but it doesn't make any difference whether you change
it or not.



[2006-01-20 11:31:09] [EMAIL PROTECTED]

Ilia, this is propably some issue on FreeBSD, I can't reproduce with
Linux.



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


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

2006-01-29 Thread ale at FreeBSD dot org
 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:

Please *stop* saying shit, please! Your attitude towards FreeBSD is
just stupid and all your bug database is pervaded by this arrogance;
accusing FreeBSD for your coding deficiencies is incredibly childish.
Even if you think so, Linux is not the OS reference and the 'optreset'
variable existed *before* the birth of Linux and FreeBSD.

This is taken from 4.3BSD:

 The variables opterr and optind are both initialized to 1.  The
optind
 variable may be set to another value before a set of calls to
getopt() in
 order to skip over more or less argv entries.

 In order to use getopt() to evaluate multiple sets of arguments,
or to
 evaluate a single set of arguments multiple times, the variable
optreset
 must be set to 1 before the second and each additional set of
calls to
 getopt(), and the variable optind must be reinitialized.

 The optreset variable was added to make it possible to call the
getopt()
 function multiple times.


Previous Comments:


[2006-01-24 01:15:43] [EMAIL PROTECTED]

Reassigned to myself.
I'll commit the patch as soon as I figure out if it works on Solaris
and AIX.



[2006-01-20 13:30:34] [EMAIL PROTECTED]

Changing optind re-initalization to optind = 1; fixes it for me on
FreeBSD (and works on Linux).
Though it still makes we wonder why FreeBSD prefers to have its own
implementation of everything: for some reasons they also have `extern
int optreset;`, but it doesn't make any difference whether you change
it or not.



[2006-01-20 11:31:09] [EMAIL PROTECTED]

Ilia, this is propably some issue on FreeBSD, I can't reproduce with
Linux.



[2006-01-20 10:39:47] oli at isnic dot is

Same result, I also tried with -n so that nothing was being 
taken from the php.ini, and again it works fine when 
compiled without the forementioned "fix"

# cat t.php 
#!/usr/local/bin/php

# ./t.php -s -b 1
array(0) {
}



[2006-01-19 20:46:40] [EMAIL PROTECTED]

This works just fine for me:

test.php:

#!sapi/cli/php


#./t.php -s -b 1
array(2) {
  ["s"]=>
  bool(false)
  ["b"]=>
  string(1) "1"
}

Works the same with both 5.1.2 and 4.4.2.
Try this same script please. (change the hashbang path, of course :)



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