#36723 [NEW]: getopt test fails
| From: | gml4410 at ggr dot co dot uk | Date: | Mon, 13 Mar 2006 17:43:20 +0000 |
| Subject: | #36723 [NEW]: getopt test fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-94297@lists.php.net to get a copy of this message | ||
From: gml4410 at ggr dot co dot uk
Operating system: Solaris8
PHP version: 4.4.2
PHP Bug Type: *Compile Issues
Bug description: getopt test fails
Description:
------------
Bug #36091 actualy fixes this, but you might like an explanation of why
settign optind to 1 and not 0 works.
Bascially, it *documented* that it needs to be set to 1!
Bug #35564 added a fix for recurring getopt()s of:
+ /* Force reinitialization of getopt() (via optind reset) on
every call. */
+ optind = 0;
+
However, the Open group standrad for getopt() (see
http://www.opengroup.org/onlinepubs/009695399/functions/getopt.html)
states:
>> The variable optind is the index of the next element
>> of the argv[] vector to be processed. It shall be
>> initialized to 1 by the system,
Whereas Linux (well, GNU glibc) is happy with a 0 setting to restart
things other OSes (eg: Solaris) are not.
This line must be chanegd to "optind = 1;" to work across all systems
(tested on linux and Solaris).
Reproduce code:
---------------
Just build php and run "make test". The test report wil include this
line in the FAILED TEST SUMMARY.
getopt [ext/standard/tests/general_functions/getopt.phpt]
--
Edit bug report at http://bugs.php.net/?id=36723&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36723&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36723&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36723&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36723&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36723&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36723&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36723&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36723&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36723&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36723&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36723&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36723&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36723&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36723&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36723&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36723&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36723&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36723&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36723&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36723&r=mysqlcfg