<?xml version="1.0"?>
<?xml-stylesheet 
 href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/11068/bug">
    <title>PEAR Bug #11068</title>
    <link>http://pear.php.net/bugs/11068</link>
    <description>[Closed] No way to read plain &quot;-&quot; option</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bugs/11068"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/11068/2007-06-12+10%3A59%3A16#2007-06-12+10%3A59%3A16"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/11068/2007-06-12+10%3A44%3A22#2007-06-12+10%3A44%3A22"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/11068/2007-06-12+10%3A39%3A15#2007-06-12+10%3A39%3A15"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/11068/2007-06-11+01%3A41%3A16#2007-06-11+01%3A41%3A16"/>
     </rdf:Seq>
    </items>
  </channel>
    <item rdf:about="http://pear.php.net/bugs/11068">
      <title>cardoe</title>
      <link>http://pear.php.net/bugs/11068</link>
      <description><![CDATA[<pre>Console_Getopt Bug
Reported by cardoe
2007-05-17T20:29:37-00:00
PHP: 5.2.1 OS: n/a Package Version: 1.2.2

Description:
------------
It's common for apps that have a usage of:

Usage: myapp [OPTION]... FILE

to allow &quot;-&quot; to be the FILE option to mean STDIN. However, Console_Getopt will not provide that back to you.

Test script:
---------------
&lt;?php

require_once 'Console/GetOpt.php';

$short = &quot;h&quot;;

$con = new Console_Getopt;
$args = $con-&gt;readPHPArgv();
array_shift($args);
$options = $con-&gt;getopt2($args, $short);

print_r($options);

?&gt;

php script.php -h -

Expected result:
----------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
            [0] =&gt; -
        )

)


Actual result:
--------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)</pre>]]></description>
      <content:encoded><![CDATA[<pre>Console_Getopt Bug
Reported by cardoe
2007-05-17T20:29:37-00:00
PHP: 5.2.1 OS: n/a Package Version: 1.2.2

Description:
------------
It's common for apps that have a usage of:

Usage: myapp [OPTION]... FILE

to allow &quot;-&quot; to be the FILE option to mean STDIN. However, Console_Getopt will not provide that back to you.

Test script:
---------------
&lt;?php

require_once 'Console/GetOpt.php';

$short = &quot;h&quot;;

$con = new Console_Getopt;
$args = $con-&gt;readPHPArgv();
array_shift($args);
$options = $con-&gt;getopt2($args, $short);

print_r($options);

?&gt;

php script.php -h -

Expected result:
----------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
            [0] =&gt; -
        )

)


Actual result:
--------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)</pre>]]></content:encoded>
      <dc:date>2007-05-17T20:29:37-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/11068/2007-06-12+10%3A59%3A16#2007-06-12+10%3A59%3A16">
      <title>cellog [2007-06-12 14:59]</title>
      <link>http://pear.php.net/bugs/11068#1181660356</link>
      <description><![CDATA[<pre>This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

you've convinced me</pre>]]></description>
      <content:encoded><![CDATA[<pre>This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

you've convinced me</pre>]]></content:encoded>
      <dc:date>2007-06-12T14:59:16-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/11068/2007-06-12+10%3A44%3A22#2007-06-12+10%3A44%3A22">
      <title>cardoe [2007-06-12 14:44]</title>
      <link>http://pear.php.net/bugs/11068#1181659462</link>
      <description><![CDATA[<pre>I should provide a link.

http://www.opengroup.org/onlinepubs/000095399/functions/getopt.html

If, when getopt() is called:
...
argv[optind]  points to the string &quot;-&quot;

getopt() shall return -1 without changing optind.

i.e. Essentially optind is equivalent to array index [1] of the return from getopt2()</pre>]]></description>
      <content:encoded><![CDATA[<pre>I should provide a link.

http://www.opengroup.org/onlinepubs/000095399/functions/getopt.html

If, when getopt() is called:
...
argv[optind]  points to the string &quot;-&quot;

getopt() shall return -1 without changing optind.

i.e. Essentially optind is equivalent to array index [1] of the return from getopt2()</pre>]]></content:encoded>
      <dc:date>2007-06-12T14:44:22-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/11068/2007-06-12+10%3A39%3A15#2007-06-12+10%3A39%3A15">
      <title>cardoe [2007-06-12 14:39]</title>
      <link>http://pear.php.net/bugs/11068#1181659155</link>
      <description><![CDATA[<pre>I thought the point of this extension was to provide a POSIX compliant getopt() implementation?

- is a perfectly valid flag that should not be parsed and provided to the application. The utility guidelines of POSIX explicitly mention that - is denoted to be used for standard input. Specifically, -- - is redundant and unnecessary as per the spec.</pre>]]></description>
      <content:encoded><![CDATA[<pre>I thought the point of this extension was to provide a POSIX compliant getopt() implementation?

- is a perfectly valid flag that should not be parsed and provided to the application. The utility guidelines of POSIX explicitly mention that - is denoted to be used for standard input. Specifically, -- - is redundant and unnecessary as per the spec.</pre>]]></content:encoded>
      <dc:date>2007-06-12T14:39:15-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/11068/2007-06-11+01%3A41%3A16#2007-06-11+01%3A41%3A16">
      <title>cellog [2007-06-11 05:41]</title>
      <link>http://pear.php.net/bugs/11068#1181540476</link>
      <description><![CDATA[<pre>Console_Getopt also allows this usage for what you need:

myapp -- -

where -- is the end of options.

As - without an option could often be a typo, I don't think the supplied patch is the best option.  Perhaps also adding a facility to explicitly allow this with the options passed into Console_Getopt?  Not sure how this would look.</pre>]]></description>
      <content:encoded><![CDATA[<pre>Console_Getopt also allows this usage for what you need:

myapp -- -

where -- is the end of options.

As - without an option could often be a typo, I don't think the supplied patch is the best option.  Perhaps also adding a facility to explicitly allow this with the options passed into Console_Getopt?  Not sure how this would look.</pre>]]></content:encoded>
      <dc:date>2007-06-11T05:41:16-00:00</dc:date>
    </item>
</rdf:RDF>