diff --git a/getopts.php b/getopts.php index aae5dbc..b1e03e0 100644 --- a/getopts.php +++ b/getopts.php @@ -88,7 +88,8 @@ class getopts else $long = array (); } - if (substr ($short, 0, 1) !== false && $short[0] === ":") + if (substr ($short, 0, 1) !== false && substr ($short, 0, 1) !== "" && + $short[0] === ":") throw new \Exception ("Short option can't start by semi-colon", 500); if ((strpos ($short, ":") !== false || strpos (implode ($long), ":") !== false) && @@ -109,7 +110,8 @@ class getopts $short = $matches[0]; foreach ($short as $key=>$s) { - if (substr ($s, 1) !== false && substr ($s, 1) !== ":") + if (substr ($s, 1) !== false && substr ($s, 1) !== ":" && + substr ($s, 1) !== "") throw new \Exception ( "Short parameter is invalid : only one letter allowed", 500); $short[$key] = "-".$s;