From 6342bdbf1b39ab503f9fd70985f2ddacedad4766 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Wed, 19 Jun 2013 09:33:31 -0700 Subject: [PATCH] Don't pass environment variables with "\n" to LightProcesses A recent diff started (correctly) passing the environment through to child processes. It turns out our LightProcess implementation can't handle environment variables with new lines in them, so (for now) strip out any such variables. --- hphp/runtime/ext/ext_process.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hphp/runtime/ext/ext_process.cpp b/hphp/runtime/ext/ext_process.cpp index 02ac4b191..15fdceb57 100644 --- a/hphp/runtime/ext/ext_process.cpp +++ b/hphp/runtime/ext/ext_process.cpp @@ -814,7 +814,10 @@ Variant f_proc_open(CStrRef cmd, CArrRef descriptorspec, VRefParam pipes, nvpair += iter.first().toString(); nvpair += '='; nvpair += iter.second().toString(); - envs.push_back(nvpair.detach().c_str()); + string tmp = nvpair.detach().c_str(); + if (tmp.find('\n') == string::npos) { + envs.push_back(tmp); + } } child = LightProcess::proc_open(cmd.c_str(), created, intended,