cvs: php4 /pear/Console Getopt.php

From: Date: Sun, 11 Nov 2001 04:09:09 +0000
Subject: cvs: php4 /pear/Console Getopt.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1290@lists.php.net to get a copy of this message
mfischer Sat Nov 10 23:09:09 2001 EDT Modified files: /php4/pear/Console Getopt.php Log: Add missing loop variable $i. Suppress more warnings when using the option separator '--'. Index: php4/pear/Console/Getopt.php diff -u php4/pear/Console/Getopt.php:1.5 php4/pear/Console/Getopt.php:1.6 --- php4/pear/Console/Getopt.php:1.5 Sat Nov 10 22:59:22 2001 +++ php4/pear/Console/Getopt.php Sat Nov 10 23:09:08 2001 @@ -17,7 +17,7 @@ // | Authors: Andrei Zmievski <andrei@ispi.net> | // +----------------------------------------------------------------------+ // -// $Id: Getopt.php,v 1.5 2001/11/11 03:59:22 mfischer Exp $ +// $Id: Getopt.php,v 1.6 2001/11/11 04:09:08 mfischer Exp $ require_once 'PEAR.php'; @@ -75,7 +75,7 @@ sort($long_options); reset($args); - while (list(, $arg) = each($args)) { + while (list($i, $arg) = each($args)) { /* The special element '--' means explicit end of options. Treat the rest of the arguments as non-options and end the loop. */ @@ -84,9 +84,9 @@ break; } - if ($arg{0} != '-' || ($arg{1} == '-' && !$long_options)) { + if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) { $non_opts[] = $arg; - } else if ($arg{1} == '-') { + } else if (strlen($arg) > 1 && $arg{1} == '-') { $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args); if (PEAR::isError($error)) return $error;

« previous php.pear.cvs (#1290) next »