cvs: pear-core / package-Console_Getopt.xml /Console Getopt.php

From: Date: Thu, 01 Feb 2007 05:27:30 +0000
Subject: cvs: pear-core / package-Console_Getopt.xml /Console Getopt.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-5368@lists.php.net to get a copy of this message
cellog Thu Feb 1 05:27:30 2007 UTC Modified files: /pear-core package-Console_Getopt.xml /pear-core/Console Getopt.php Log: * fix Bug #4475: An ambiguous error occurred when specifying similar longoption name. http://cvs.php.net/viewvc.cgi/pear-core/package-Console_Getopt.xml?r1=1.11&r2=1.12&diff_format=u Index: pear-core/package-Console_Getopt.xml diff -u pear-core/package-Console_Getopt.xml:1.11 pear-core/package-Console_Getopt.xml:1.12 --- pear-core/package-Console_Getopt.xml:1.11 Thu Dec 11 19:37:02 2003 +++ pear-core/package-Console_Getopt.xml Thu Feb 1 05:27:30 2007 @@ -29,9 +29,11 @@ </maintainer> </maintainers> <release> - <version>1.2</version> - <date>2003-12-11</date> - <notes>Fix to preserve BC with 1.0 and allow correct behaviour for new users</notes> + <version>1.2.2</version> + <date>2007-02-05</date> + <notes> + * fix Bug #4475: An ambiguous error occurred when specifying similar longoption name. + </notes> <state>stable</state> <filelist> <dir name="Console"> @@ -41,6 +43,28 @@ </release> <changelog> <release> + <version>1.2.1</version> + <date>2006-12-08</date> + <notes>Fixed bugs #4448 (Long parameter values truncated with longoption parameter) and #7444 (Trailing spaces after php closing tag)</notes> + <state>stable</state> + <filelist> + <dir name="Console"> + <file role="php" name="Getopt.php"/> + </dir> + </filelist> + </release> + <release> + <version>1.2</version> + <date>2003-12-11</date> + <notes>Fix to preserve BC with 1.0 and allow correct behaviour for new users</notes> + <state>stable</state> + <filelist> + <dir name="Console"> + <file role="php" name="Getopt.php"/> + </dir> + </filelist> + </release> + <release> <version>1.0</version> <date>2002-09-13</date> <notes>Stable release</notes> http://cvs.php.net/viewvc.cgi/pear-core/Console/Getopt.php?r1=1.29&r2=1.30&diff_format=u Index: pear-core/Console/Getopt.php diff -u pear-core/Console/Getopt.php:1.29 pear-core/Console/Getopt.php:1.30 --- pear-core/Console/Getopt.php:1.29 Fri Dec 8 17:28:37 2006 +++ pear-core/Console/Getopt.php Thu Feb 1 05:27:30 2007 @@ -16,7 +16,7 @@ // | Author: Andrei Zmievski <andrei@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Getopt.php,v 1.29 2006/12/08 17:28:37 andrei Exp $ +// $Id: Getopt.php,v 1.30 2007/02/01 05:27:30 cellog Exp $ require_once 'PEAR.php'; @@ -189,19 +189,24 @@ for ($i = 0; $i < count($long_options); $i++) { $long_opt = $long_options[$i]; - $opt_start = substr($long_opt, 0, $opt_len); + $opt_start = substr($long_opt, 0, $opt_len);\ + $long_opt_name = str_replace('=', '', $long_opt); /* Option doesn't match. Go on to the next one. */ - if ($opt_start != $opt) + if ($long_opt_name != $opt) { continue; + } $opt_rest = substr($long_opt, $opt_len); /* Check that the options uniquely matches one of the allowed options. */ + $next_option_rest = substr($long_options[$i + 1], $opt_len); if ($opt_rest != '' && $opt{0} != '=' && $i + 1 < count($long_options) && - $opt == substr($long_options[$i+1], 0, $opt_len)) { + $opt == substr($long_options[$i+1], 0, $opt_len) && + $next_option_rest != '' && + $next_option_rest{0} != '=') { return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous"); }

« previous php.pear.core (#5368) next »