From f87874ca033fbcfb9ce8f570610af25c34d4b1d0 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 22 May 2014 09:17:53 +0000 Subject: [PATCH] Don't look at & in stdin entries in CLI git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1343 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- cli.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli.php b/cli.php index 9a4056a..f71378c 100644 --- a/cli.php +++ b/cli.php @@ -196,14 +196,18 @@ class cli if (in_array ("-", $argv)) { $tab = array_keys ($argv, "-"); - $key = reset ($tab); - $argv[$key] = file_get_contents ("php://stdin"); + $keyStdIn = reset ($tab); + $dataStdIn = file_get_contents ("php://stdin"); + $argv[$keyStdIn] = $dataStdIn; } // Convert "toto=ror&ypyp=oo" arg to array("toto"=>"ror","ypyp"=>"oo") // (Array management in CLI) foreach ($argv as $key=>$arg) { + // Don't modify the stdin + if ($key === $keyStdIn) + continue; $pairs = explode('&', $arg); foreach($pairs as $pair) {