From 3b5b7f48848d098c6190781f8790a1b0dcb0217c Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Fri, 22 Feb 2013 19:17:56 -0700 Subject: Updated exit codes as constant values Re-allocated exit status codes according to three references, which follow: BSD sysexits.h:http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits GNU recomendations:http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html Bash scripting:http://tldp.org/LDP/abs/html/exitcodes.html The GNU recommendations stem from and expand upon the standard C/C++ library (stdlibc) definitions, while also suggesting some best-practice conventions which happen to prevent exit status code collisions with bash, and probably other shells. The re-allocated codes are now mapped to constant values, set in *application/config/constants.php*, and used throughout the CodeIgniter core. They would additionally be used in *index.php*, but the constants file hasn't been loaded at that point, so the integer values are used instead, and a comment follows each such use with amplifying information on why that particular value was selected. Finally, the errors documentation has been updated accordingly. Signed-off-by: Daniel Hunsaker --- system/libraries/Driver.php | 2 +- system/libraries/Trackback.php | 4 ++-- system/libraries/Xmlrpcs.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index ba15f81df..9a56013ab 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -290,7 +290,7 @@ class CI_Driver { $trace = debug_backtrace(); _exception_handler(E_ERROR, "No such method '{$method}'", $trace[1]['file'], $trace[1]['line']); - exit(3); + exit(EXIT_UNK_MEMBER); } // -------------------------------------------------------------------- diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index cc93b2e30..ea8017efd 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -212,7 +212,7 @@ class CI_Trackback { public function send_error($message = 'Incomplete Information') { echo '\n\n1\n".$message."\n"; - exit(0); + exit(EXIT_SUCCESS); } // -------------------------------------------------------------------- @@ -228,7 +228,7 @@ class CI_Trackback { public function send_success() { echo '\n\n0\n"; - exit(0); + exit(EXIT_SUCCESS); } // -------------------------------------------------------------------- diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index 2d2e7f13b..e150c13b7 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -171,7 +171,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc { header('Content-Type: text/xml'); header('Content-Length: '.strlen($payload)); echo $payload; - exit(0); + exit(EXIT_SUCCESS); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b