Cli must allow @ or spaces in array keys. Replace the parse_str function to hand made function
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1280 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
20
cli.php
20
cli.php
@@ -202,11 +202,21 @@ class cli
|
||||
// (Array management in CLI)
|
||||
foreach ($argv as $key=>$arg)
|
||||
{
|
||||
$val = null;
|
||||
parse_str ($arg, $val);
|
||||
if (count ($val) === 1 && reset ($val) === "")
|
||||
$val = $arg;
|
||||
$argv[$key] = $val;
|
||||
$pairs = explode('&', $arg);
|
||||
|
||||
foreach($pairs as $pair) {
|
||||
@list ($name, $value) = explode ('=', $pair, 2);
|
||||
if ($value === null)
|
||||
{
|
||||
$argv[$key] = $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! is_array ($argv[$key]))
|
||||
$argv[$key] = array ();
|
||||
$argv[$key][$name] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Manage a parameter in the constructor of the class
|
||||
|
||||
Reference in New Issue
Block a user