Skip to content

Conversation

@anroots
Copy link

@anroots anroots commented Feb 28, 2016

Running the scan command and outputting the result to console would always exit with an exit code of 1 regardless of whether there were any errors found or not.

This messes up CI builds and other usages where the exit code is meaningful.

The bug was caused by invalid assumption in the result value of Output\Console::render: the $fail variable is an integer, not an array.

The following illustrates the previous situation and how using count always resulted in the exit code of 1.

php > $fail = 0;
php > var_dump((count($fail) > 0) ? 1 : 0);
int(1)
php > $fail = 1;
php > var_dump((count($fail) > 0) ? 1 : 0);
int(1)

This patch fixes the bug; Output\Console::render now treats the $fail variable as an integer and returns a correct exit status.

Running the Scan command and outputting the result to console
would always exit with an exit code of `1` regardless of whether
there were any errors found or not.

This messes up CI builds and other usages where the exit code is
meaningful.

The bug was caused by invalid assumption in the result value of
`Output\Console::render`: the `$fail` variable is an integer, not an array.

This patch fixes the bug; `Output\Console::render` now treats the
`$fail` variable as an integer and returns a correct exit status.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant