Doc #74827 [NEW]: Documentation incorrect regarding getopt options
| From: | sciron64 at sindtech dot org | Date: | Thu, 29 Jun 2017 02:40:47 +0000 |
| Subject: | Doc #74827 [NEW]: Documentation incorrect regarding getopt options | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-14795@lists.php.net to get a copy of this message | ||
From: sciron64 at sindtech dot org
Operating system: GNU/Linux
PHP version: 7.0.20
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Documentation incorrect regarding getopt options
Description:
------------
---
From manual page: http://www.php.net/function.getopt
---
http://php.net/manual/en/function.getopt.php
states 3 options can be
passed to getopt:
"array getopt ( string $options [, array $longopts [, int &$optind ]]
)"
Except $optind is unable to be processed by PHP v7.0.20.
To put another way, getopt only accepts _TWO_ parameters, not the
documented three.
Test script:
---------------
<?php
$optInd = -1;
getopt("abcd",array("alfa", "beta", "charlie",
"delta"), $optInd);
Expected result:
----------------
No error message when using 3rd parameter.
Actual result:
--------------
PHP Warning: getopt() expects at most 2 parameters, 3 given in
/var/www/scripts/getopt-test.php on line 3
--
Edit bug report at https://bugs.php.net/bug.php?id=74827&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74827&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74827&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74827&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74827&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74827&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74827&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74827&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74827&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74827&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74827&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74827&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74827&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74827&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74827&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74827&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74827&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74827&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74827&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74827&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74827&r=mysqlcfg