ID: 29714
Updated by: [EMAIL PROTECTED]
Reported By: lists at cyberlot dot net
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: Fedora Core 2
PHP Version: 5.0.0
New Comment:
Fixed in 5.1.2
Previous Comments:
------------------------------------------------------------------------
[2004-08-17 01:05:09] lists at cyberlot dot net
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 this bug report at http://bugs.php.net/?id=29714&edit=1