]> granicus.if.org Git - php/commitdiff
* tolerate $args being empty
authorStig Bakken <ssb@php.net>
Tue, 9 Jul 2002 10:52:25 +0000 (10:52 +0000)
committerStig Bakken <ssb@php.net>
Tue, 9 Jul 2002 10:52:25 +0000 (10:52 +0000)
pear/Console/Getopt.php

index 834ab8c5041553947a22b5a98d76591629fbda97..50c567d065d2c65d3301ab63acf856b313f5023a 100644 (file)
@@ -69,14 +69,17 @@ class Console_Getopt {
         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);
         }