|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-01-19 18:05 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 05:00:01 2025 UTC |
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 :)Same result, I also tried with -n so that nothing was being taken from the php.ini, and again it works fine when compiled without the forementioned "fix" # cat t.php #!/usr/local/bin/php <?php $options = getopt("b:s"); var_dump($options); ?> # ./t.php -s -b 1 array(0) { }