From 5aab8b2b8b8599b6a3562968aec824410025b4e1 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Tue, 9 Jul 2002 10:52:25 +0000 Subject: [PATCH] * tolerate $args being empty --- pear/Console/Getopt.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pear/Console/Getopt.php b/pear/Console/Getopt.php index 834ab8c504..50c567d065 100644 --- a/pear/Console/Getopt.php +++ b/pear/Console/Getopt.php @@ -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); } -- 2.40.0