-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
status codes #7
status codes #7
Conversation
Taken from the PHP manual: http://us3.php.net/manual/en/function.exit.php The status code integer 255 should not be used at all according to the PHP documentation. While it looks like it can be used, they are asking that developers refrain from doing such. |
Good point, thanks for bringing it up. Do you know the exact reason behind this? I grepped the php source but I can't really find where it is used. 255 seems to be the exit code (at the shell level) on some fatal errors, like failing require_once, or calling a non existing function. But, for example a parse error returns 254. Which seems strange. Maybe it's better change it to exit(-1), which gets translated to 255 in bash too: Suggestions? (ps: in the meantime, this was already committed upstream in Symfony, by Fabien) |
This is an upstream bug, please report it with symfony |
Fix codestyle with use statements for new XmlMapping tests
if you return a status code bigger than 255, bash will see it as status code 0. Proof:
$ php -r "exit(255);" ; echo $? 255
$ php -r "exit(256);" ; echo $? 0
This is also in the bash manpage in the section "EXIT STATUS". This fix makes sure an error code stays an error code (round it to 255, which means "error code out of range" by the way), so we can check for it. I noticed this because Doctrine 2.0 migrations threw a PDO exception and tried to exit with code 23000. This became an exit(0) and our buildsystem did a thumbs up. Obviously not ok :-)