Bug #65931 [Com]: getopt fails to return optional argument when specified
| From: | support at shockandawemedia dot com | Date: | Fri, 15 Nov 2013 16:30:11 +0000 |
| Subject: | Bug #65931 [Com]: getopt fails to return optional argument when specified | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182776@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65931&edit=1
ID: 65931
Comment by: support at shockandawemedia dot com
Reported by: support at shockandawemedia dot com
Summary: getopt fails to return optional argument when
specified
Status: Not a bug
Type: Bug
Package: Variables related
Operating System: Gnu Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Hi,
I reported it as a bug, because, at least as I understood the php manual on the function, it should
have operated as I expected-- but didn't. All elements in the array should be filled in.
Nonetheless, close this. I wrote a CLI handler in 40-lines that offers full fexibility. Don't
you just love PCRE!
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2013-10-25 06:02:13] yohgaki@php.net
If this is feature request, duplicate of #26818
------------------------------------------------------------------------
[2013-10-25 05:59:45] yohgaki@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
I think we don't support following form
$ php ./gotest.php -a arg1 -b arg2 -c arg3
but
$ php ./gotest.php -a arg1 -b=arg2 -c arg3
or
$ php ./gotest.php -a arg1 -barg2 -c arg3
------------------------------------------------------------------------
[2013-10-18 22:05:19] support at shockandawemedia dot com
Description:
------------
---
From manual page: http://www.php.net/function.getopt#refsect1-function.getopt-returnvalues
---
This function is useless if it cannot work with optional arguments at all.
Test script:
---------------
<?php
$argsA = getopt("a:b::c:");
var_dump($argsA);
?>
Expected result:
----------------
The string value 'arg2' should have appeared in the argument array for index
'b'.
Actual result:
--------------
$ php ./gotest.php -a arg1 -b arg2 -c arg3
array(3) {
["a"]=>
string(4) "arg1"
["b"]=>
bool(false)
["c"]=>
string(4) "arg3"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65931&edit=1