From 6b9180a23ded06648ea8c79251e96ce87dd5c94f Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Wed, 5 Jun 2013 10:18:46 +0200 Subject: [PATCH] [Console] ensure exit code between 0-254 255 is reserved by PHP and should not be used also put this code inside the codeCoverageIgnore block because it cannot be tested with phpunit --- src/Symfony/Component/Console/Application.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index d4ad03a02f..2c7d3de736 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -126,11 +126,9 @@ class Application } if ($this->autoExit) { - if ($statusCode > 255) { - $statusCode = 255; - } + // ensure exit code is between 0-254 (255 is reserved by PHP and should not be used) // @codeCoverageIgnoreStart - exit($statusCode); + exit(max(0, min(254, $statusCode))); // @codeCoverageIgnoreEnd }