Issue Bug Closed

#82246CLI return code overflow and reserved code 255

Oliver Eglseder 08/30/17, 15:41 updated 10/02/18, 10:57

Description

When executing a command which results in an exception the exception code will be passed to PHP’s function exit() without further investigation, which will actually result in any return code between 0 and 255.
This has two bad implications, first of all using timestamps as an exception code will eventually yield a code (e.g. 1504100352) that results in 0 retuned by the command which implies that there was nothing wrong (very bad!) and other codes like “1504100095” which result in 255, which is reserved for PHP according to the documentation of PHP: http://php.net/manual/en/function.exit.php
Affected LTS version are 7 and 8. Version 9 relies on symfony/console which limits these codes at least to 255 (i already submitted a patch to limit them to 254).

Reviews 2