Skip to content

Commit caa47f8

Browse files
Merge branch '6.0' into 6.1
* 6.0: (23 commits) Fix composer on appveyor fix bootstrap_3_layout ChoiceType's expanded label_html [Messenger][Security/Core] Remove legacy class aliases [PropertyAccess] Fix typo in PropertyAccessor::readProperty() DocBlock [PropertyInfo] PhpStanExtractor namespace missmatch issue [VarExporter] Fix exporting objects with readonly properties [ExpressionLanguage] Fix matches when the regexp is not valid [Messenger] Add mysql indexes back and work around deadlocks using soft-delete Add BC layer to handle old objects already present in cache [RateLimiter] Always store SlidingWindows with an expiration set [Validator] Fix File constraint invalid max size exception message [Console] Fix exit status on uncaught exception with negative code [Validator] fix #43345 @Assert\DivisibleBy [HttpClient] fix 303 after PUT and sending chunked requests [HttpClient] always send Content-Type when a body is passed [HttpClient] always send Content-Length when a body is passed [HttpClient] fix sending Content-Length/Type for POST Fix merge [HttpClient] fix sending PUT requests with curl Fix locales format in CrowdinProvider ...
2 parents ca700c0 + 70dcf7b commit caa47f8

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null
179179
$exitCode = $e->getCode();
180180
if (is_numeric($exitCode)) {
181181
$exitCode = (int) $exitCode;
182-
if (0 === $exitCode) {
182+
if ($exitCode <= 0) {
183183
$exitCode = 1;
184184
}
185185
} else {

Tests/ApplicationTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,25 @@ public function testRunDispatchesExitCodeOneForExceptionCodeZero()
11721172
$this->assertTrue($passedRightValue, '-> exit code 1 was passed in the console.terminate event');
11731173
}
11741174

1175+
/**
1176+
* @testWith [-1]
1177+
* [-32000]
1178+
*/
1179+
public function testRunReturnsExitCodeOneForNegativeExceptionCode($exceptionCode)
1180+
{
1181+
$exception = new \Exception('', $exceptionCode);
1182+
1183+
$application = $this->getMockBuilder(Application::class)->setMethods(['doRun'])->getMock();
1184+
$application->setAutoExit(false);
1185+
$application->expects($this->once())
1186+
->method('doRun')
1187+
->willThrowException($exception);
1188+
1189+
$exitCode = $application->run(new ArrayInput([]), new NullOutput());
1190+
1191+
$this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is '.$exceptionCode);
1192+
}
1193+
11751194
public function testAddingOptionWithDuplicateShortcut()
11761195
{
11771196
$this->expectException(\LogicException::class);

0 commit comments

Comments
 (0)