cvs: php4 /pear/Console Getopt.php
| From: | Stig Bakken | Date: | Tue, 09 Jul 2002 10:52:25 +0000 |
| Subject: | cvs: php4 /pear/Console Getopt.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4980@lists.php.net to get a copy of this message | ||
ssb Tue Jul 9 06:52:25 2002 EDT
Modified files:
/php4/pear/Console Getopt.php
Log:
* tolerate $args being empty
Index: php4/pear/Console/Getopt.php
diff -u php4/pear/Console/Getopt.php:1.15 php4/pear/Console/Getopt.php:1.16
--- php4/pear/Console/Getopt.php:1.15 Sun May 26 08:13:47 2002
+++ php4/pear/Console/Getopt.php Tue Jul 9 06:52:25 2002
@@ -16,7 +16,7 @@
// | Author: Andrei Zmievski <andrei@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Getopt.php,v 1.15 2002/05/26 12:13:47 ssb Exp $
+// $Id: Getopt.php,v 1.16 2002/07/09 10:52:25 ssb Exp $
require_once 'PEAR.php';
@@ -69,14 +69,17 @@
if (PEAR::isError($args)) {
return $args;
}
+ if (empty($args)) {
+ return array(array(), array());
+ }
$opts = array();
$non_opts = array();
settype($args, 'array');
- if ($long_options)
+ if ($long_options) {
sort($long_options);
-
+ }
if ($args[0]{0} != '-') {
array_shift($args);
}