From 353f9834adf3f44c6c7a0f924089bb2b43360404 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Thu, 24 Jan 2013 17:09:10 -0700 Subject: Updated all cases of exit() to return a valid code Specific codes are as follows, but can easily be changed if a different order/breakdown makes more sense: - 0: Success; everything executed as planned - 1: Configuration Error; something is wrong with/in the configuration file(s) - 2: Class Not Found; what it says - 3: Driver Method Unsupported; the method you're trying to use on a Driver doesn't exist - 4: File Not Found; 404 error - 5: Database Error; something is broken in the database somewhere - 6: Invalid Input; the user attempted to submit a request with invlaid characters in 1+ key names 7 through 26 are reserved for future use - 27: Generic Error; generated by show_error() when the status code is >= 100 28 through 127 are errors generated by user applications, normally by using show_error() with a status code below 100 128 through 254 should not be used by applications, as they are reserved by system-level functions - 255: PHP Fatal Error; automatically generated by PHP for fatal errors, and therefore not allowed for our use Status codes below 100 are shifted up by 28 to place them in the user error range. It may make more sense to have these codes left alone and instead shift the CI errors into the 101 through 127 space, but that's not what I opted for here. It would probably also be a good idea to replace the hard-coded numbers with constants or some such, but I was in a bit of a hurry when I made these changes, so I didn't look around for the best place to do this. With proper guidance, I could easily amend this commit with another that uses such constant values. Signed-off-by: Daniel Hunsaker --- system/core/CodeIgniter.php | 2 +- system/core/Common.php | 29 ++++++++++++++++++++++------- system/core/Exceptions.php | 2 +- system/core/Input.php | 3 ++- system/core/Output.php | 2 +- system/database/DB_driver.php | 2 +- system/helpers/download_helper.php | 5 +++-- system/helpers/url_helper.php | 2 +- system/libraries/Driver.php | 2 +- system/libraries/Trackback.php | 4 ++-- system/libraries/Xmlrpcs.php | 3 ++- 11 files changed, 37 insertions(+), 19 deletions(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 8affde64d..13826c328 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -188,7 +188,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) === TRUE) { - exit; + exit(0); } /* diff --git a/system/core/Common.php b/system/core/Common.php index d494caf80..d6387209b 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -1,3 +1,4 @@ + show_error($heading, $message, 'error_general', $status_code); - exit; + exit($exit_status); } } @@ -392,7 +407,7 @@ if ( ! function_exists('show_404')) { $_error =& load_class('Exceptions', 'core'); $_error->show_404($page, $log_error); - exit; + exit(4); } } @@ -514,11 +529,11 @@ if ( ! function_exists('set_status_header')) if (strpos(php_sapi_name(), 'cgi') === 0) { - header('Status: '.$code.' '.$text, TRUE); + if (!headers_sent()) header('Status: '.$code.' '.$text, TRUE); } else { - header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); + if (!headers_sent()) header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); } } } diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index e6023e73b..f799d6027 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -117,7 +117,7 @@ class CI_Exceptions { } echo $this->show_error($heading, $message, 'error_404', 404); - exit; + exit(4); } // -------------------------------------------------------------------- diff --git a/system/core/Input.php b/system/core/Input.php index 82e22dd49..8f37e4464 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -745,7 +745,8 @@ class CI_Input { if ( ! preg_match('/^[a-z0-9:_\/|-]+$/i', $str)) { set_status_header(503); - exit('Disallowed Key Characters.'); + echo 'Disallowed Key Characters.'; + exit(6); } // Clean UTF-8 if supported diff --git a/system/core/Output.php b/system/core/Output.php index a20841463..7898d1972 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -696,7 +696,7 @@ class CI_Output { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $last_modified <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $this->set_status_header(304); - exit; + exit(0); } else { diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 35ac8e870..cb2ef4ac8 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1658,7 +1658,7 @@ abstract class CI_DB_driver { $error =& load_class('Exceptions', 'core'); echo $error->show_error($heading, $message, 'error_db'); - exit; + exit(5); } // -------------------------------------------------------------------- diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 7294d50c5..d7691cb61 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -141,7 +141,8 @@ if ( ! function_exists('force_download')) // If we have raw data - just dump it if ($data !== NULL) { - exit($data); + echo $data; + exit(0); } // Flush 1MB chunks of data @@ -151,7 +152,7 @@ if ( ! function_exists('force_download')) } fclose($fp); - exit; + exit(0); } } diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index a6536cf81..9a0153542 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -549,7 +549,7 @@ if ( ! function_exists('redirect')) header('Location: '.$uri, TRUE, $code); break; } - exit; + exit(0); } } diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 4b35dce73..bb7318991 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -291,7 +291,7 @@ class CI_Driver { $trace = debug_backtrace(); _exception_handler(E_ERROR, "No such method '{$method}'", $trace[1]['file'], $trace[1]['line']); - exit; + exit(3); } // -------------------------------------------------------------------- diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ecc7129e3..cc93b2e30 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; + exit(0); } // -------------------------------------------------------------------- @@ -228,7 +228,7 @@ class CI_Trackback { public function send_success() { echo '\n\n0\n"; - exit; + exit(0); } // -------------------------------------------------------------------- diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index d4524d230..465a1967b 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -170,7 +170,8 @@ class CI_Xmlrpcs extends CI_Xmlrpc { header('Content-Type: text/xml'); header('Content-Length: '.strlen($payload)); - exit($payload); + echo $payload; + exit(0); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b 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/core/CodeIgniter.php | 2 +- system/core/Common.php | 16 ++++++++++------ system/core/Exceptions.php | 2 +- system/core/Input.php | 2 +- system/core/Output.php | 2 +- system/database/DB_driver.php | 2 +- system/helpers/download_helper.php | 4 ++-- system/helpers/url_helper.php | 2 +- system/libraries/Driver.php | 2 +- system/libraries/Trackback.php | 4 ++-- system/libraries/Xmlrpcs.php | 2 +- 11 files changed, 22 insertions(+), 18 deletions(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 5a872ef21..8f5271add 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -188,7 +188,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) === TRUE) { - exit(0); + exit(EXIT_SUCCESS); } /* diff --git a/system/core/Common.php b/system/core/Common.php index 3cd97dc2e..479f0da7f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -177,7 +177,7 @@ if ( ! function_exists('load_class')) // self-referencing loop with the Exceptions class set_status_header(503); echo 'Unable to locate the specified class: '.$class.'.php'; - exit(2); + exit(EXIT_UNK_CLASS); } // Keep track of what we just loaded @@ -251,7 +251,7 @@ if ( ! function_exists('get_config')) { set_status_header(503); echo 'The configuration file does not exist.'; - exit(1); + exit(EXIT_CONFIG); } // Does the $config array exist in the file? @@ -259,7 +259,7 @@ if ( ! function_exists('get_config')) { set_status_header(503); echo 'Your config file does not appear to be formatted correctly.'; - exit(1); + exit(EXIT_CONFIG); } // Are any values being dynamically replaced? @@ -374,12 +374,16 @@ if ( ! function_exists('show_error')) $status_code = abs($status_code); if ($status_code < 100) { - $exit_status = $status_code + 28; + $exit_status = $status_code + EXIT__AUTO_MIN; + if ($exit_status > EXIT__AUTO_MAX) + { + $exit_status = EXIT_FAILURE; + } $status_code = 500; } else { - $exit_status = 27; + $exit_status = EXIT_FAILURE; } $_error =& load_class('Exceptions', 'core'); @@ -407,7 +411,7 @@ if ( ! function_exists('show_404')) { $_error =& load_class('Exceptions', 'core'); $_error->show_404($page, $log_error); - exit(4); + exit(EXIT_UNK_FILE); } } diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index f799d6027..423387ff9 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -117,7 +117,7 @@ class CI_Exceptions { } echo $this->show_error($heading, $message, 'error_404', 404); - exit(4); + exit(EXIT_UNK_FILE); } // -------------------------------------------------------------------- diff --git a/system/core/Input.php b/system/core/Input.php index 904f4d6e9..8d491e055 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -746,7 +746,7 @@ class CI_Input { { set_status_header(503); echo 'Disallowed Key Characters.'; - exit(6); + exit(EXIT_USER_INPUT); } // Clean UTF-8 if supported diff --git a/system/core/Output.php b/system/core/Output.php index d4abe871d..1025703dc 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -696,7 +696,7 @@ class CI_Output { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $last_modified <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $this->set_status_header(304); - exit(0); + exit(EXIT_SUCCESS); } else { diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 6ae1d524d..18dbbc76e 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1658,7 +1658,7 @@ abstract class CI_DB_driver { $error =& load_class('Exceptions', 'core'); echo $error->show_error($heading, $message, 'error_db'); - exit(5); + exit(EXIT_DATABASE); } // -------------------------------------------------------------------- diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index daf59f51b..25863eaa4 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -142,7 +142,7 @@ if ( ! function_exists('force_download')) if ($data !== NULL) { echo $data; - exit(0); + exit(EXIT_SUCCESS); } // Flush 1MB chunks of data @@ -152,7 +152,7 @@ if ( ! function_exists('force_download')) } fclose($fp); - exit(0); + exit(EXIT_SUCCESS); } } diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index d6bf7e2c9..7d5ccff35 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -550,7 +550,7 @@ if ( ! function_exists('redirect')) header('Location: '.$uri, TRUE, $code); break; } - exit(0); + exit(EXIT_SUCCESS); } } 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 From 50dfe0175df02fe4aa243757bdf1b42fb9fc3169 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 4 Mar 2013 02:05:20 -0700 Subject: Updated in accordance with feedback from @narfbg - Removed commented lists of constants from the three reference conventions, replacing each with the URLs at which more information can be found. - Renamed a few constants to more closely reflect CodeIgniter conventions. - Modified a couple of lines which were in violation of the CI Style Guide. Signed-off-by: Daniel Hunsaker --- system/core/Common.php | 23 +++++++++++++---------- system/core/Exceptions.php | 2 +- system/helpers/download_helper.php | 4 ++-- system/libraries/Driver.php | 2 +- system/libraries/Xmlrpcs.php | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) (limited to 'system') diff --git a/system/core/Common.php b/system/core/Common.php index 479f0da7f..e11668d5f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -177,7 +177,7 @@ if ( ! function_exists('load_class')) // self-referencing loop with the Exceptions class set_status_header(503); echo 'Unable to locate the specified class: '.$class.'.php'; - exit(EXIT_UNK_CLASS); + exit(EXIT_UNKNOWN_CLASS); } // Keep track of what we just loaded @@ -377,13 +377,13 @@ if ( ! function_exists('show_error')) $exit_status = $status_code + EXIT__AUTO_MIN; if ($exit_status > EXIT__AUTO_MAX) { - $exit_status = EXIT_FAILURE; + $exit_status = EXIT_ERROR; } $status_code = 500; } else { - $exit_status = EXIT_FAILURE; + $exit_status = EXIT_ERROR; } $_error =& load_class('Exceptions', 'core'); @@ -411,7 +411,7 @@ if ( ! function_exists('show_404')) { $_error =& load_class('Exceptions', 'core'); $_error->show_404($page, $log_error); - exit(EXIT_UNK_FILE); + exit(EXIT_UNKNOWN_FILE); } } @@ -531,13 +531,16 @@ if ( ! function_exists('set_status_header')) $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : FALSE; - if (strpos(php_sapi_name(), 'cgi') === 0) + if ( ! headers_sent()) { - if (!headers_sent()) header('Status: '.$code.' '.$text, TRUE); - } - else - { - if (!headers_sent()) header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); + if (strpos(php_sapi_name(), 'cgi') === 0) + { + header('Status: '.$code.' '.$text, TRUE); + } + else + { + header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); + } } } } diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 423387ff9..9c68d06a5 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -117,7 +117,7 @@ class CI_Exceptions { } echo $this->show_error($heading, $message, 'error_404', 404); - exit(EXIT_UNK_FILE); + exit(EXIT_UNKNOWN_FILE); } // -------------------------------------------------------------------- diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 25863eaa4..bd3296574 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -142,7 +142,7 @@ if ( ! function_exists('force_download')) if ($data !== NULL) { echo $data; - exit(EXIT_SUCCESS); + exit; } // Flush 1MB chunks of data @@ -152,7 +152,7 @@ if ( ! function_exists('force_download')) } fclose($fp); - exit(EXIT_SUCCESS); + exit; } } diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 9a56013ab..1bc365cbc 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(EXIT_UNK_MEMBER); + exit(EXIT_UNKNOWN_METHOD); } // -------------------------------------------------------------------- diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index e150c13b7..a6048cb9f 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(EXIT_SUCCESS); + exit; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From b2ac67a3a766ac18f5041eff7a5cbeef7437a184 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 4 Mar 2013 02:31:26 -0700 Subject: Oops, missed a few places where EXIT_SUCCESS was being used. Signed-off-by: Daniel Hunsaker --- system/core/CodeIgniter.php | 2 +- system/core/Output.php | 2 +- system/helpers/url_helper.php | 2 +- system/libraries/Trackback.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 8f5271add..7f76977b5 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -188,7 +188,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) === TRUE) { - exit(EXIT_SUCCESS); + exit; } /* diff --git a/system/core/Output.php b/system/core/Output.php index 1025703dc..25ecd496c 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -696,7 +696,7 @@ class CI_Output { if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $last_modified <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $this->set_status_header(304); - exit(EXIT_SUCCESS); + exit; } else { diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 7d5ccff35..d0fab3fe0 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -550,7 +550,7 @@ if ( ! function_exists('redirect')) header('Location: '.$uri, TRUE, $code); break; } - exit(EXIT_SUCCESS); + exit; } } diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ea8017efd..ecc7129e3 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(EXIT_SUCCESS); + exit; } // -------------------------------------------------------------------- @@ -228,7 +228,7 @@ class CI_Trackback { public function send_success() { echo '\n\n0\n"; - exit(EXIT_SUCCESS); + exit; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 8626e93d5b4362c86a58933dda9206ac8810476d Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 4 Mar 2013 05:14:22 -0700 Subject: Reverting changes to functions that have no business being used in CLI apps to begin with Signed-off-by: Daniel Hunsaker --- system/core/Common.php | 15 ++++++--------- system/helpers/download_helper.php | 3 +-- system/libraries/Trackback.php | 6 ++---- system/libraries/Xmlrpcs.php | 3 +-- 4 files changed, 10 insertions(+), 17 deletions(-) (limited to 'system') diff --git a/system/core/Common.php b/system/core/Common.php index e11668d5f..9baf5e315 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -531,16 +531,13 @@ if ( ! function_exists('set_status_header')) $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : FALSE; - if ( ! headers_sent()) + if (strpos(php_sapi_name(), 'cgi') === 0) { - if (strpos(php_sapi_name(), 'cgi') === 0) - { - header('Status: '.$code.' '.$text, TRUE); - } - else - { - header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); - } + header('Status: '.$code.' '.$text, TRUE); + } + else + { + header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); } } } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index bd3296574..4fe6a0e88 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -141,8 +141,7 @@ if ( ! function_exists('force_download')) // If we have raw data - just dump it if ($data !== NULL) { - echo $data; - exit; + exit($data); } // Flush 1MB chunks of data diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ecc7129e3..5a45be8dd 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -211,8 +211,7 @@ class CI_Trackback { */ public function send_error($message = 'Incomplete Information') { - echo '\n\n1\n".$message."\n"; - exit; + exit('\n\n1\n".$message."\n"); } // -------------------------------------------------------------------- @@ -227,8 +226,7 @@ class CI_Trackback { */ public function send_success() { - echo '\n\n0\n"; - exit; + exit('\n\n0\n"); } // -------------------------------------------------------------------- diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index a6048cb9f..d263d789d 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -170,8 +170,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc { header('Content-Type: text/xml'); header('Content-Length: '.strlen($payload)); - echo $payload; - exit; + exit($payload); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b