getopts: substr in PHP7 has not the same result as PHP5.
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3807 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -88,7 +88,8 @@ class getopts
|
|||||||
else
|
else
|
||||||
$long = array ();
|
$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);
|
throw new \Exception ("Short option can't start by semi-colon", 500);
|
||||||
if ((strpos ($short, ":") !== false ||
|
if ((strpos ($short, ":") !== false ||
|
||||||
strpos (implode ($long), ":") !== false) &&
|
strpos (implode ($long), ":") !== false) &&
|
||||||
@@ -109,7 +110,8 @@ class getopts
|
|||||||
$short = $matches[0];
|
$short = $matches[0];
|
||||||
foreach ($short as $key=>$s)
|
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 (
|
throw new \Exception (
|
||||||
"Short parameter is invalid : only one letter allowed", 500);
|
"Short parameter is invalid : only one letter allowed", 500);
|
||||||
$short[$key] = "-".$s;
|
$short[$key] = "-".$s;
|
||||||
|
|||||||
Reference in New Issue
Block a user