Merge branch '3.2'
* 3.2: [Process] Fix ignoring of bad env var names
This commit is contained in:
commit
68e1cb81f2
@ -1137,6 +1137,11 @@ class Process implements \IteratorAggregate
|
||||
*/
|
||||
public function setEnv(array $env)
|
||||
{
|
||||
// Process can not handle env values that are arrays
|
||||
$env = array_filter($env, function ($value) {
|
||||
return !is_array($value);
|
||||
});
|
||||
|
||||
$this->env = $env;
|
||||
|
||||
return $this;
|
||||
|
@ -1385,6 +1385,18 @@ class ProcessTest extends TestCase
|
||||
$this->assertSame('456', $p2->getOutput());
|
||||
}
|
||||
|
||||
public function testSetBadEnv()
|
||||
{
|
||||
$process = $this->getProcess('echo hello');
|
||||
$process->setEnv(array('bad%%' => '123'));
|
||||
$process->inheritEnvironmentVariables(true);
|
||||
|
||||
$process->run();
|
||||
|
||||
$this->assertSame('hello'.PHP_EOL, $process->getOutput());
|
||||
$this->assertSame('', $process->getErrorOutput());
|
||||
}
|
||||
|
||||
public function testEnvIsInherited()
|
||||
{
|
||||
$process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ'));
|
||||
|
Reference in New Issue
Block a user