#46359 [NEW]: getopt fails to recognize '?' as a short option

From: Date: Tue, 21 Oct 2008 20:25:46 +0000
Subject: #46359 [NEW]: getopt fails to recognize '?' as a short option
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1226@lists.php.net to get a copy of this message
From:             johnston dot joshua at gmail dot com
Operating system: OS X 10.5.x and OpenSuSE
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  getopt fails to recognize '?' as a short option

Description:
------------
getopt() accepts a "?" character as a short option but does not return it
if it is present in argv. It doesn't say anywhere in the manual about ?
being a special character or which characters are accepted. It is common
practice to use -h/-? as options that mean show the help

I don't know if this is a documentation error or function error.

Reproduce code:
---------------
<?php
var_dump(getopt('?'));



Expected result:
----------------
jjohnston@devws37:~> php test.php -?
array(0) {
  ["?"]=>
  bool(false)
}

Actual result:
--------------
jjohnston@devws37:~> php test.php -?
array(0) {
}

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



Thread (4 messages)

« previous php.doc.bugs (#1226) next »