| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2012-02-07 03:45 UTC] carloschilazo at gmail dot com
  [2012-03-08 19:47 UTC] iliaa@php.net
 
-Status: Open
+Status: Not a bug
  [2012-03-08 19:47 UTC] iliaa@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 13:00:02 2025 UTC | 
Description: ------------ If a CLI argument is passed with leading whitespace, the value is not picked up by getopt() if specified as an optional value (with two colons). This is contrary to the documentation, which states, "Option values are the first argument after the string. It does not matter if a value has leading white space or not." Test script: --------------- <?php var_dump(getopt('v')); var_dump(getopt('v:')); var_dump(getopt('v::')); ?> $ ./test.php -v2 asdf # behaves as expected $ ./test.php -v=2 asdf # behaves as expected $ ./test.php -v 2 asdf # problem case, shown in actual result Expected result: ---------------- array(1) { ["v"]=> bool(false) } array(1) { ["v"]=> string(1) "2" } array(1) { ["v"]=> string(1) "2" } Actual result: -------------- array(1) { ["v"]=> bool(false) } array(1) { ["v"]=> string(1) "2" } array(1) { ["v"]=> bool(false) }