8000 Restore bypass_shell by default with windows compat · symfony/symfony@54cfd44 · GitHub
[go: up one dir, main page]

Skip to content

Commit 54cfd44

Browse files
committed
Restore bypass_shell by default with windows compat
1 parent 38df47a commit 54cfd44

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function __construct($commandline, $cwd = null, array $env = null, $stdin
116116
}
117117
$this->stdin = $stdin;
118118
$this->timeout = $timeout;
119-
$this->options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false), $options);
119+
$this->options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true), $options);
120120
}
121121

122122
/**
@@ -164,6 +164,9 @@ public function run($callback = null)
164164

165165
if (defined('PHP_WINDOWS_VERSION_BUILD') && $this->enhanceWindowsCompatibility) {
166166
$commandline = 'cmd /V:ON /E:ON /C "'.$commandline.'"';
167+
if (!isset($this->options['bypass_shell'])) {
168+
$this->options['bypass_shell'] = true;
169+
}
167170
}
168171

169172
$process = proc_open($commandline, $descriptors, $pipes, $this->cwd, $this->env, $this->options);

src/Symfony/Component/Process/ProcessBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(array $arguments = array())
3232

3333
$this->timeout = 60;
3434
$this->options = array();
35-
$this->inheritEnv = false;
35+
$this->inheritEnv = true;
3636
}
3737

3838
public static function create(array $arguments = array())
@@ -112,7 +112,7 @@ public function getProcess()
112112

113113
$env = null;
114114
if ($this->inheritEnv) {
115-
$env = $_ENV ? $this->env + $_ENV : $this->env;
115+
$env = $this->env ? $this->env + $_ENV : null;
116116
} else {
117117
$env = $this->env;
118118
}

tests/Symfony/Tests/Component/Process/ProcessBuilderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function shouldInheritEnvironmentVars()
2727
$pb->add('foo')->inheritEnvironmentVariables();
2828
$proc = $pb->getProcess();
2929

30-
$this->assertEquals($expected, $proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
30+
$this->assertEquals(null, $proc->getEnv(), '->inheritEnvironmentVariables() copies $_ENV');
3131

3232
$_ENV = $snapshot;
3333
}
@@ -54,12 +54,12 @@ public function shouldInheritAndOverrideEnvironmentVars()
5454
/**
5555
* @test
5656
*/
57-
public function shouldNotInheritEnvironmentVarsByDefault()
57+
public function shouldInheritEnvironmentVarsByDefault()
5858
{
5959
$pb = new ProcessBuilder();
6060
$proc = $pb->add('foo')->getProcess();
6161

62-
$this->assertEquals(array(), $proc->getEnv());
62+
$this->assertEquals(null, $proc->getEnv());
6363
}
6464

6565
/**

0 commit comments

Comments
 (0)
0