From: lists at cyberlot dot net
Operating system: Fedora Core 2
PHP version: 5.0.0
PHP Bug Type: Feature/Change Request
Bug description: getopt does not reset
Description:
------------
You can only call getopt a single time and get results. Getopt should
reset what ever pointers it uses to ensure state is as it was prior to
calling getopt.
An example.. A modular based system using a config file or command line to
load a module, It is impossible for the module to use getopt to look for
module specific settings because getopt has already been called by the
main engine.
./engine -loadmod abc -abcdb 123
It is impossible for mod abc to realize it needs to load database 123
because any attempts to run getopt based on those new params fail.
Reproduce code:
---------------
<?
$cl_input = getopt('c:h');
print_r($cl_input);
$cl_input = getopt('c:h');
print_r($cl_input);
?>
Expected result:
----------------
[EMAIL PROTECTED] streams]# php test.php -c 1
Array
(
[c] => 1
)
Array
(
[c] => 1
)
Actual result:
--------------
[EMAIL PROTECTED] streams]# php test.php -c 1
Array
(
[c] => 1
)
Array
(
)
--
Edit bug report at http://bugs.php.net/?id=29714&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29714&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29714&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29714&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29714&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29714&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29714&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29714&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29714&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29714&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29714&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29714&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29714&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29714&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29714&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29714&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29714&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29714&r=float