From:             lapo at lapo dot it
Operating system: anything but FreeBSD
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  getopt() second parameter is never used

Description:
------------
http://it.php.net/manual/en/function.getopt.php
This page states that as of 4.3.0 PHP has got a second parameter called
longopts that should enable getopt_long functionality.

The first problem is that it doesn't have any specific example, and the
format of such parameter is not explained at all.

The second, and biggest, problem is that the functionality never made it
in any PHP release except 4.3.0pre2 as it was created in version:
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?view=log#rev1.533
and removed 9 days later, in version
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?view=log#rev1.540
by the very author.

Reproduce code:
---------------
% cat test.php 
#!/usr/local/bin/php
<?
$o = getopt('f:hp:', array('file:'));
print_r($o);
?>


Expected result:
----------------
% ./test.php --file=a
Array
(
    [file] => a
)


Actual result:
--------------
% ./test.php --file=a
Array
(
    [f] => ile=a
)


-- 
Edit bug report at http://bugs.php.net/?id=36319&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36319&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36319&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36319&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36319&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36319&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36319&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36319&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36319&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36319&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36319&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36319&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36319&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36319&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36319&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36319&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36319&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36319&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36319&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36319&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36319&r=mysqlcfg

Reply via email to