8000 Merge branch '6.0' into 6.1 · symfony/console@7a86c1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a86c1c

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: Fix double authentication via RememberMe resulting in wrong RememberMe cookie being set in client [Security] Fix legacy impersonation system Fix global state pollution between tests run with ApplicationTester µcs fix [Messenger] Do not log the message object itself [Intl] Fix the IntlDateFormatter::formatObject signature
2 parents 6187424 + d8d41b9 commit 7a86c1c

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

Tester/ApplicationTester.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,37 @@ public function __construct(Application $application)
4949
*/
5050
public function run(array $input, array $options = []): int
5151
{
52-
$this->input = new ArrayInput($input);
53-
if (isset($options['interactive'])) {
54-
$this->input->setInteractive($options['interactive']);
55-
}
52+
$prevShellVerbosity = getenv('SHELL_VERBOSITY');
5653

57-
if ($this->inputs) {
58-
$this->input->setStream(self::createStream($this->inputs));
59-
}
54+
try {
55+
$this->input = new ArrayInput($input);
56+
if (isset($options['interactive'])) {
57+
$this->input->setInteractive($options['interactive']);
58+
}
6059

61-
$this->initOutput($options);
60+
if ($this->inputs) {
61+
$this->input->setStream(self::createStream($this->inputs));
62+
}
6263

63-
return $this->statusCode = $this->application->run($this->input, $this->output);
64+
$this->initOutput($options);
65+
66+
return $this->statusCode = $this->application->run($this->input, $this->output);
67+
} finally {
68+
// SHELL_VERBOSITY is set by Application::configureIO so we need to unset/reset it
69+
// to its previous value to avoid one test's verbosity to spread to the following tests
70+
if (false === $prevShellVerbosity) {
71+
if (\function_exists('putenv')) {
72+
@putenv('SHELL_VERBOSITY');
73+
}
74+
unset($_ENV['SHELL_VERBOSITY']);
75+
unset($_SERVER['SHELL_VERBOSITY']);
76+
} else {
77+
if (\function_exists('putenv')) {
78+
@putenv('SHELL_VERBOSITY='.$prevShellVerbosity);
79+
}
80+
$_ENV['SHELL_VERBOSITY'] = $prevShellVerbosity;
81+
$_SERVER['SHELL_VERBOSITY'] = $prevShellVerbosity;
82+
}
83+
}
6484
}
6585
}

0 commit comments

Comments
 (0)
0