ID:               36091
 User updated by:  oli at isnic dot is
 Reported By:      oli at isnic dot is
-Status:           Feedback
+Status:           Open
 Bug Type:         *General Issues
 Operating System: FreeBSD 5.4
 PHP Version:      4.4.2
 New Comment:

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) {
}


Previous Comments:
------------------------------------------------------------------------

[2006-01-19 20:46:40] [EMAIL PROTECTED]

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 :)

------------------------------------------------------------------------

[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

Reply via email to