Skip to content

Commit 445b2e3

Browse files
committed
[Console] fix status code when Exception::getCode returns something like 0.1
1 parent 28a9001 commit 445b2e3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,16 @@ public function run(InputInterface $input = null, OutputInterface $output = null
113113
} else {
114114
$this->renderException($e, $output);
115115
}
116-
$statusCode = $e->getCode();
117116

118-
$statusCode = is_numeric($statusCode) && $statusCode ? (int) $statusCode : 1;
117+
$statusCode = $e->getCode();
118+
if (is_numeric($statusCode)) {
119+
$statusCode = (int) $statusCode;
120+
if (0 === $statusCode) {
121+
$statusCode = 1;
122+
}
123+
} else {
124+
$statusCode = 1;
125+
}
119126
}
120127

121128
if ($this->autoExit) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy