<?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/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=Console_Getopt</link>
    <description>Search Results</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/bug/14684" />
      <rdf:li rdf:resource="http://pear.php.net/bug/13140" />
      <rdf:li rdf:resource="http://pear.php.net/bug/11954" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/14684">
      <title>Console_Getopt: Bug 14684 [Open] console_getopt provides different results depending on platform used.</title>
      <link>http://pear.php.net/bugs/14684</link>
      <content:encoded><![CDATA[<pre>Console_Getopt Bug
Reported by kguest
2008-09-21T19:13:19+00:00
PHP: 5.2.4 OS: Windows/Linux Package Version: 1.2.3

Description:
------------
with the command $ pear size -t doc,php -v pear_size on linux, the
options and params variables passed to the doSize function, the $options
and $params parameters passed ultimately from Console_Getopt to doSize
are populated thus:
Array
(
    [type] =&gt; doc,php
    [verbose] =&gt; 1
)
Array
(
    [0] =&gt; pear_size
)


On Windows, with the same command, the arrays are populated by
console_getopt as:
Array
(
    [type] =&gt; doc
)
Array
(
    [0] =&gt; php
    [1] =&gt; -v
    [2] =&gt; pear_size
)

This discrepancy manifests itself as the bug that Laurent reported.
The pearsize script does not have these problems as it utilizes
Console_GetArgs rather than the console_getopt component.

Actual result:
--------------
would expect the options and params arrays to be filled identically irregardless of which platform is used.</pre>]]></content:encoded>
      <description><![CDATA[<pre>Console_Getopt Bug
Reported by kguest
2008-09-21T19:13:19+00:00
PHP: 5.2.4 OS: Windows/Linux Package Version: 1.2.3

Description:
------------
with the command $ pear size -t doc,php -v pear_size on linux, the
options and params variables passed to the doSize function, the $options
and $params parameters passed ultimately from Console_Getopt to doSize
are populated thus:
Array
(
    [type] =&gt; doc,php
    [verbose] =&gt; 1
)
Array
(
    [0] =&gt; pear_size
)


On Windows, with the same command, the arrays are populated by
console_getopt as:
Array
(
    [type] =&gt; doc
)
Array
(
    [0] =&gt; php
    [1] =&gt; -v
    [2] =&gt; pear_size
)

This discrepancy manifests itself as the bug that Laurent reported.
The pearsize script does not have these problems as it utilizes
Console_GetArgs rather than the console_getopt component.

Actual result:
--------------
would expect the options and params arrays to be filled identically irregardless of which platform is used.</pre>]]></description>
      <dc:date>2008-09-21T19:13:19+00:00</dc:date>
      <dc:creator>ken &amp;#x61;&amp;#116; linux &amp;#x64;&amp;#111;&amp;#x74; ie</dc:creator>
      <dc:subject>Console_Getopt Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/13140">
      <title>Console_Getopt: Feature/Change Request 13140 [Open] [PATCH] to skip unknown parameters.</title>
      <link>http://pear.php.net/bugs/13140</link>
      <content:encoded><![CDATA[<pre>Console_Getopt Feature/Change Request
Reported by rquadling
2008-02-18T04:24:04+00:00
PHP: 5.2.5 OS: Windows XP SP2 Package Version: 1.2.3

Description:
------------
Hi.

I have the need to quickly see if a param has been supplied without knowing if any other param has been supplied.

The supplied patch amends GetOpt to optionally ignore the unknown parameters when testing for the 1 I want.

The test script below wants to get -t or --test and is set to ignore unknown options.

So, running it like this ...

test.php --bob --foo -bar --test -rq

See &quot;expected result&quot;

Whilst this is similar to http://pear.php.net/bugs/bug.php?id=10988, I am not storing the unknown params, simply ignoring unknown params are supplied.




Test script:
---------------
&lt;?php
// Suppress PHP5 notices.
error_reporting(!E_NOTICE);

// Include getopt.
require_once 'Console/Getopt.php';

$o_CG = new Console_GetOpt();

print_r($o_CG-&gt;getopt($o_CG-&gt;readPHPArgv(), 't', array('test'), True));
print_r($o_CG-&gt;getopt($o_CG-&gt;readPHPArgv(), 'bar', array('foo'), True));

if (PEAR::isError($a_Result))
{
    die('Error in command line: ' . $a_Result-&gt;getMessage() . PHP_EOL);
}

error_reporting(E_ALL);



Expected result:
----------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; test
                    [1] =&gt;
                )

        )

    [1] =&gt; Array
        (
        )

)
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; foo
                    [1] =&gt;
                )

            [1] =&gt; Array
                (
                    [0] =&gt; b
                    [1] =&gt;
                )

            [2] =&gt; Array
                (
                    [0] =&gt; a
                    [1] =&gt;
                )

            [3] =&gt; Array
                (
                    [0] =&gt; r
                    [1] =&gt;
                )

            [4] =&gt; Array
                (
                    [0] =&gt; r
                    [1] =&gt;
                )

        )

    [1] =&gt; Array
        (
        )

)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Console_Getopt Feature/Change Request
Reported by rquadling
2008-02-18T04:24:04+00:00
PHP: 5.2.5 OS: Windows XP SP2 Package Version: 1.2.3

Description:
------------
Hi.

I have the need to quickly see if a param has been supplied without knowing if any other param has been supplied.

The supplied patch amends GetOpt to optionally ignore the unknown parameters when testing for the 1 I want.

The test script below wants to get -t or --test and is set to ignore unknown options.

So, running it like this ...

test.php --bob --foo -bar --test -rq

See &quot;expected result&quot;

Whilst this is similar to http://pear.php.net/bugs/bug.php?id=10988, I am not storing the unknown params, simply ignoring unknown params are supplied.




Test script:
---------------
&lt;?php
// Suppress PHP5 notices.
error_reporting(!E_NOTICE);

// Include getopt.
require_once 'Console/Getopt.php';

$o_CG = new Console_GetOpt();

print_r($o_CG-&gt;getopt($o_CG-&gt;readPHPArgv(), 't', array('test'), True));
print_r($o_CG-&gt;getopt($o_CG-&gt;readPHPArgv(), 'bar', array('foo'), True));

if (PEAR::isError($a_Result))
{
    die('Error in command line: ' . $a_Result-&gt;getMessage() . PHP_EOL);
}

error_reporting(E_ALL);



Expected result:
----------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; test
                    [1] =&gt;
                )

        )

    [1] =&gt; Array
        (
        )

)
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; foo
                    [1] =&gt;
                )

            [1] =&gt; Array
                (
                    [0] =&gt; b
                    [1] =&gt;
                )

            [2] =&gt; Array
                (
                    [0] =&gt; a
                    [1] =&gt;
                )

            [3] =&gt; Array
                (
                    [0] =&gt; r
                    [1] =&gt;
                )

            [4] =&gt; Array
                (
                    [0] =&gt; r
                    [1] =&gt;
                )

        )

    [1] =&gt; Array
        (
        )

)</pre>]]></description>
      <dc:date>2008-02-18T04:24:04+00:00</dc:date>
      <dc:creator>RQuadling &amp;#x61;&amp;#116; GMail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Console_Getopt Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/11954">
      <title>Console_Getopt: Bug 11954 [Open] long opt return -- in option, short opt do not</title>
      <link>http://pear.php.net/bugs/11954</link>
      <content:encoded><![CDATA[<pre>Console_Getopt Bug
Reported by spearhead
2007-09-01T13:00:31+00:00
PHP: 5.2.1 OS: ubuntu 7.04 Package Version: 1.2.3

Description:
------------
for short options the option is returned minus the &quot;-&quot;, for long options the -- is included. This is inconsistent and confusing.

e.g. for the script below
php foo.php --port 1231 --version -v -h

Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; --port
                    [1] =&gt; 1231
                )

            [1] =&gt; Array
                (
                    [0] =&gt; --version
                    [1] =&gt; 
                )

            [2] =&gt; Array
                (
                    [0] =&gt; v
                    [1] =&gt; 
                )

            [3] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)


Test script:
---------------
 $con  = new Console_Getopt;
        $args = $con-&gt;readPHPArgv();
        if(PEAR::isError($args)) {
                //
         }

        array_shift($args);
        $shortopt = &quot;Dp:t:vh&quot;;
        $longopt = array(&quot;version&quot;, &quot;help&quot;, &quot;port=&quot;, &quot;timeout=&quot;);
        
        $options = $con-&gt;getopt($args, $shortopt, $longopt);
        if(PEAR::isError($options)) {
                //
        }
        print_r($options);


Expected result:
----------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; port
                    [1] =&gt; 1231
                )

            [1] =&gt; Array
                (
                    [0] =&gt; version
                    [1] =&gt; 
                )

            [2] =&gt; Array
                (
                    [0] =&gt; v
                    [1] =&gt; 
                )

            [3] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)


Actual result:
--------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; --port
                    [1] =&gt; 1231
                )

            [1] =&gt; Array
                (
                    [0] =&gt; --version
                    [1] =&gt; 
                )

            [2] =&gt; Array
                (
                    [0] =&gt; v
                    [1] =&gt; 
                )

            [3] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)</pre>]]></content:encoded>
      <description><![CDATA[<pre>Console_Getopt Bug
Reported by spearhead
2007-09-01T13:00:31+00:00
PHP: 5.2.1 OS: ubuntu 7.04 Package Version: 1.2.3

Description:
------------
for short options the option is returned minus the &quot;-&quot;, for long options the -- is included. This is inconsistent and confusing.

e.g. for the script below
php foo.php --port 1231 --version -v -h

Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; --port
                    [1] =&gt; 1231
                )

            [1] =&gt; Array
                (
                    [0] =&gt; --version
                    [1] =&gt; 
                )

            [2] =&gt; Array
                (
                    [0] =&gt; v
                    [1] =&gt; 
                )

            [3] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)


Test script:
---------------
 $con  = new Console_Getopt;
        $args = $con-&gt;readPHPArgv();
        if(PEAR::isError($args)) {
                //
         }

        array_shift($args);
        $shortopt = &quot;Dp:t:vh&quot;;
        $longopt = array(&quot;version&quot;, &quot;help&quot;, &quot;port=&quot;, &quot;timeout=&quot;);
        
        $options = $con-&gt;getopt($args, $shortopt, $longopt);
        if(PEAR::isError($options)) {
                //
        }
        print_r($options);


Expected result:
----------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; port
                    [1] =&gt; 1231
                )

            [1] =&gt; Array
                (
                    [0] =&gt; version
                    [1] =&gt; 
                )

            [2] =&gt; Array
                (
                    [0] =&gt; v
                    [1] =&gt; 
                )

            [3] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)


Actual result:
--------------
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; --port
                    [1] =&gt; 1231
                )

            [1] =&gt; Array
                (
                    [0] =&gt; --version
                    [1] =&gt; 
                )

            [2] =&gt; Array
                (
                    [0] =&gt; v
                    [1] =&gt; 
                )

            [3] =&gt; Array
                (
                    [0] =&gt; h
                    [1] =&gt; 
                )

        )

    [1] =&gt; Array
        (
        )

)</pre>]]></description>
      <dc:date>2007-09-01T13:00:31+00:00</dc:date>
      <dc:creator>gavinspearhead &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Console_Getopt Bug</dc:subject>
    </item>
</rdf:RDF>
