From 6d50f264f5ba81963d8913480982c75bca6a5b06 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 21 Apr 2014 18:47:15 +0000 Subject: [PATCH] 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 --- cli.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cli.php b/cli.php index 7c9ffc4..aa30f0c 100644 --- a/cli.php +++ b/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