#36091 [Opn->Fbk]: getopt() returns false on every call
| From: | sniper@php.net | Date: | Thu, 19 Jan 2006 19:46:41 +0000 |
| Subject: | #36091 [Opn->Fbk]: getopt() returns false on every call | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92232@lists.php.net to get a copy of this message | ||
ID: 36091
Updated by: sniper@php.net
-Summary: getopt() returns false on every call (works with PHP
5.1)
Reported By: oli at isnic dot is
-Status: Open
+Status: Feedback
Bug Type: *General Issues
Operating System: FreeBSD 5.4
PHP Version: 4.4.2
New Comment:
This works just fine for me:
test.php:
#!sapi/cli/php
<?php
$options = getopt("b:s");
var_dump($options);
?>
#./t.php -s -b 1
array(2) {
["s"]=>
bool(false)
["b"]=>
string(1) "1"
}
Works the same with both 5.1.2 and 4.4.2.
Try this same script please. (change the hashbang path, of course :)
Previous Comments:
------------------------------------------------------------------------
[2006-01-19 18:05:43] oli at isnic dot is
Description:
------------
The "fix" in bug #35594 breaks getopt() in PHP4 completely
on my system, it returns false on every call now.
FreeBSD 5.4-RELEASE-p8 and php-4.4.2 updated today.
Removing the "fix" makes getopt() work again.
Reproduce code:
---------------
$options = getopt("b:s");
if (!$options) {
print("\$options is false\n");
}
else {
foreach ($options as $key => $value) {
if ($value) {
print($key."=".$value."\n");
}
else {
print($key."=false\n");
}
}
}
exit(0);
Expected result:
----------------
#./getopt.php -s -b 1
s=false
b=1
Actual result:
--------------
#./getopt.php -s -b 1
$options is false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36091&edit=1