Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5bf740

Browse filesBrowse files
asika32764nicolas-grekas
authored andcommitted
[Process] Fix Process::getEnv() when setEnv() hasn't been called before
1 parent 464385f commit a5bf740
Copy full SHA for a5bf740

File tree

2 files changed

+5
-2
lines changed
Filter options

2 files changed

+5
-2
lines changed

‎src/Symfony/Component/Process/Process.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Process.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Process implements \IteratorAggregate
5353
private $hasCallback = false;
5454
private $commandline;
5555
private $cwd;
56-
private $env;
56+
private $env = [];
5757
private $input;
5858
private $starttime;
5959
private $lastOutputTime;

‎src/Symfony/Component/Process/Tests/ProcessTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/ProcessTest.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,8 +1505,11 @@ public function testPreparedCommandWithNoValues()
15051505

15061506
public function testEnvArgument()
15071507
{
1508-
$env = ['FOO' => 'Foo', 'BAR' => 'Bar'];
15091508
$cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
1509+
$p = Process::fromShellCommandline($cmd);
1510+
$this->assertSame([], $p->getEnv());
1511+
1512+
$env = ['FOO' => 'Foo', 'BAR' => 'Bar'];
15101513
$p = Process::fromShellCommandline($cmd, null, $env);
15111514
$p->run(null, ['BAR' => 'baR', 'BAZ' => 'baZ']);
15121515

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.