summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/constants.php36
-rwxr-xr-xindex.php12
-rw-r--r--system/core/Common.php28
-rw-r--r--system/core/Exceptions.php2
-rw-r--r--system/core/Input.php3
-rw-r--r--system/core/Output.php2
-rw-r--r--system/database/DB_driver.php2
-rw-r--r--system/database/DB_forge.php6
-rw-r--r--system/database/DB_query_builder.php41
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php41
-rw-r--r--system/database/drivers/mysql/mysql_driver.php41
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php41
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php41
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php2
-rw-r--r--system/libraries/Driver.php2
-rw-r--r--system/libraries/Email.php9
-rw-r--r--system/libraries/Image_lib.php2
-rw-r--r--system/libraries/Trackback.php6
-rw-r--r--user_guide_src/source/changelog.rst2
-rw-r--r--user_guide_src/source/general/common_functions.rst2
-rw-r--r--user_guide_src/source/general/errors.rst21
-rw-r--r--user_guide_src/source/general/reserved_names.rst18
22 files changed, 165 insertions, 195 deletions
diff --git a/application/config/constants.php b/application/config/constants.php
index 58264ed5a..dc84712cd 100644
--- a/application/config/constants.php
+++ b/application/config/constants.php
@@ -73,6 +73,42 @@ define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
*/
define('SHOW_DEBUG_BACKTRACE', TRUE);
+/*
+|--------------------------------------------------------------------------
+| Exit Status Codes
+|--------------------------------------------------------------------------
+|
+| Used to indicate the conditions under which the script is exit()ing.
+| While there is no universal standard for error codes, there are some
+| broad conventions. Three such conventions are mentioned below, for
+| those who wish to make use of them. The CodeIgniter defaults were
+| chosen for the least overlap with these conventions, while still
+| leaving room for others to be defined in future versions and user
+| applications.
+|
+| The three main conventions used for determining exit status codes
+| are as follows:
+|
+| Standard C/C++ Library (stdlibc):
+| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
+| (This link also contains other GNU-specific conventions)
+| BSD sysexits.h:
+| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
+| Bash scripting:
+| http://tldp.org/LDP/abs/html/exitcodes.html
+|
+*/
+define('EXIT_SUCCESS', 0); // no errors
+define('EXIT_ERROR', 1); // generic error
+define('EXIT_CONFIG', 3); // configuration error
+define('EXIT_UNKNOWN_FILE', 4); // file not found
+define('EXIT_UNKNOWN_CLASS', 5); // unknown class
+define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
+define('EXIT_USER_INPUT', 7); // invalid user input
+define('EXIT_DATABASE', 8); // database error
+define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
+define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
+
/* End of file constants.php */
/* Location: ./application/config/constants.php */ \ No newline at end of file
diff --git a/index.php b/index.php
index be0945740..c6314da1f 100755
--- a/index.php
+++ b/index.php
@@ -67,7 +67,8 @@ switch (ENVIRONMENT)
default:
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- exit('The application environment is not set correctly.');
+ echo 'The application environment is not set correctly.';
+ exit(1); // EXIT_* constants not yet defined; 1 is EXIT_ERROR, a generic error.
}
/*
@@ -190,7 +191,8 @@ switch (ENVIRONMENT)
if ( ! is_dir($system_path))
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- exit('Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME));
+ echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
+ exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG.
}
/*
@@ -225,7 +227,8 @@ switch (ENVIRONMENT)
if ( ! is_dir(BASEPATH.$application_folder.'/'))
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- exit('Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF);
+ echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
+ exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG.
}
define('APPPATH', BASEPATH.$application_folder.'/');
@@ -241,7 +244,8 @@ switch (ENVIRONMENT)
elseif ( ! is_dir(APPPATH.'views/'))
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
- exit('Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF);
+ echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
+ exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG.
}
else
{
diff --git a/system/core/Common.php b/system/core/Common.php
index ee9bb2e87..10c22375e 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -175,7 +175,8 @@ if ( ! function_exists('load_class'))
// Note: We use exit() rather then show_error() in order to avoid a
// self-referencing loop with the Exceptions class
set_status_header(503);
- exit('Unable to locate the specified class: '.$class.'.php');
+ echo 'Unable to locate the specified class: '.$class.'.php';
+ exit(EXIT_UNKNOWN_CLASS);
}
// Keep track of what we just loaded
@@ -248,14 +249,16 @@ if ( ! function_exists('get_config'))
elseif ( ! $found)
{
set_status_header(503);
- exit('The configuration file does not exist.');
+ echo 'The configuration file does not exist.';
+ exit(EXIT_CONFIG);
}
// Does the $config array exist in the file?
if ( ! isset($config) OR ! is_array($config))
{
set_status_header(503);
- exit('Your config file does not appear to be formatted correctly.');
+ echo 'Your config file does not appear to be formatted correctly.';
+ exit(EXIT_CONFIG);
}
// Are any values being dynamically replaced?
@@ -367,9 +370,24 @@ if ( ! function_exists('show_error'))
*/
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
{
+ $status_code = abs($status_code);
+ if ($status_code < 100)
+ {
+ $exit_status = $status_code + EXIT__AUTO_MIN;
+ if ($exit_status > EXIT__AUTO_MAX)
+ {
+ $exit_status = EXIT_ERROR;
+ }
+ $status_code = 500;
+ }
+ else
+ {
+ $exit_status = EXIT_ERROR;
+ }
+
$_error =& load_class('Exceptions', 'core');
echo $_error->show_error($heading, $message, 'error_general', $status_code);
- exit;
+ exit($exit_status);
}
}
@@ -392,7 +410,7 @@ if ( ! function_exists('show_404'))
{
$_error =& load_class('Exceptions', 'core');
$_error->show_404($page, $log_error);
- exit;
+ exit(EXIT_UNKNOWN_FILE);
}
}
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index e6023e73b..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(EXIT_UNKNOWN_FILE);
}
// --------------------------------------------------------------------
diff --git a/system/core/Input.php b/system/core/Input.php
index 68a8fe03f..8d491e055 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(EXIT_USER_INPUT);
}
// Clean UTF-8 if supported
diff --git a/system/core/Output.php b/system/core/Output.php
index 25ecd496c..3320ae154 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -793,6 +793,8 @@ class CI_Output {
case 'text/css':
case 'text/javascript':
+ case 'application/javascript':
+ case 'application/x-javascript':
$output = $this->_minify_script_style($output);
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index ed0296d76..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;
+ exit(EXIT_DATABASE);
}
// --------------------------------------------------------------------
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 53cdd53b6..d52029ecd 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -680,8 +680,12 @@ abstract class CI_DB_forge {
return $sql.'DROP COLUMN '.$this->db->escape_identifiers($field);
}
+ $sql .= ($alter_type === 'ADD')
+ ? 'ADD '
+ : $alter_type.' COLUMN ';
+
$sqls = array();
- for ($i = 0, $c = count($field), $sql .= $alter_type.' COLUMN '; $i < $c; $i++)
+ for ($i = 0, $c = count($field); $i < $c; $i++)
{
$sqls[] = $sql
.($field[$i]['_literal'] !== FALSE ? $field[$i]['_literal'] : $this->_process_column($field[$i]));
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 85a233b50..292621b66 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1855,6 +1855,47 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
// --------------------------------------------------------------------
/**
+ * Update_Batch statement
+ *
+ * Generates a platform-specific batch update string from the supplied data
+ *
+ * @param string $table Table name
+ * @param array $values Update data
+ * @param string $index WHERE key
+ * @return string
+ */
+ protected function _update_batch($table, $values, $index)
+ {
+ $ids = array();
+ foreach ($values as $key => $val)
+ {
+ $ids[] = $val[$index];
+
+ foreach (array_keys($val) as $field)
+ {
+ if ($field !== $index)
+ {
+ $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
+ }
+ }
+ }
+
+ $cases = '';
+ foreach ($final as $k => $v)
+ {
+ $cases .= $k." = CASE \n"
+ .implode("\n", $v)."\n"
+ .'ELSE '.$k.' END, ';
+ }
+
+ $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
+
+ return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* The "set_update_batch" function. Allows key/value pairs to be set for batch updating
*
* @param array
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index 6663868bd..51bbbdb47 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -430,47 +430,6 @@ class CI_DB_cubrid_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k." = CASE \n"
- .implode("\n", $v)
- .'ELSE '.$k.' END, ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* FROM tables
*
* Groups tables in FROM clauses if needed, so there is no confusion
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 95003f648..b94642b35 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -456,47 +456,6 @@ class CI_DB_mysql_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k." = CASE \n"
- .implode("\n", $v)."\n"
- .'ELSE '.$k.' END, ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* FROM tables
*
* Groups tables in FROM clauses if needed, so there is no confusion
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index b64a7a2e8..ef2cb8a8d 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -427,47 +427,6 @@ class CI_DB_mysqli_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k.' = CASE '."\n"
- .implode("\n", $v)."\n"
- .'ELSE '.$k.' END, ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* FROM tables
*
* Groups tables in FROM clauses if needed, so there is no confusion
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
index 315f6f53b..ff486fc5a 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
@@ -201,47 +201,6 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index UPDATE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k." = CASE \n"
- .implode("\n", $v)."\n"
- .'ELSE '.$k.' END), ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* Truncate statement
*
* Generates a platform-specific truncate string from the supplied data
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index f1f1a30be..769bd5a26 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -133,7 +133,7 @@ class CI_Cache_file extends CI_Driver {
*/
public function clean()
{
- return delete_files($this->_cache_path);
+ return delete_files($this->_cache_path, FALSE, TRUE);
}
// ------------------------------------------------------------------------
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 382420db0..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(EXIT_UNKNOWN_METHOD);
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 728b637a3..a745d331d 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -105,9 +105,9 @@ class CI_Email {
/**
* SMTP Encryption
*
- * @var string NULL, 'tls' or 'ssl'
+ * @var string empty, 'tls' or 'ssl'
*/
- public $smtp_crypto = NULL;
+ public $smtp_crypto = '';
/**
* Whether to apply word-wrapping to the message body.
@@ -1875,7 +1875,7 @@ class CI_Email {
return TRUE;
}
- $ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : NULL;
+ $ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : '';
$this->_smtp_connect = fsockopen($ssl.$this->smtp_host,
$this->smtp_port,
@@ -2021,8 +2021,7 @@ class CI_Email {
{
return TRUE;
}
-
- if (strpos($reply, '334') !== 0)
+ elseif (strpos($reply, '334') !== 0)
{
$this->_set_error_message('lang:email_failed_smtp_login', $reply);
return FALSE;
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 0cec43fc4..b6a11a3a5 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -388,7 +388,7 @@ class CI_Image_lib {
*/
public function clear()
{
- $props = array('library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path');
+ $props = array('thumb_marker', 'library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path');
foreach ($props as $val)
{
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 '<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>1</error>\n<message>".$message."</message>\n</response>";
- exit;
+ exit('<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>1</error>\n<message>".$message."</message>\n</response>");
}
// --------------------------------------------------------------------
@@ -227,8 +226,7 @@ class CI_Trackback {
*/
public function send_success()
{
- echo '<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>0</error>\n</response>";
- exit;
+ exit('<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>0</error>\n</response>");
}
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index d805c8f10..a9c420af1 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -484,7 +484,7 @@ Bug fixes for 3.0
- Fixed a bug - :doc:`DB result <database/results>` method ``list_fields()`` didn't reset its field pointer for the *mysql*, *mysqli* and *mssql* drivers.
- Fixed a bug (#73) - :doc:`Security Library <libraries/security>` method ``sanitize_filename()`` could be tricked by an XSS attack.
- Fixed a bug (#2211) - :doc:`Migration Library <libraries/migration>` extensions couldn't execute ``CI_Migration::__construct()``.
-- Fixed a bug (#2255) - :doc:`Email Library <libraries/email>` didn't apply ``smtp_timeout``to socket reads and writes.
+- Fixed a bug (#2255) - :doc:`Email Library <libraries/email>` didn't apply ``smtp_timeout`` to socket reads and writes.
- Fixed a bug (#2239) - :doc:`Email Library <libraries/email>` improperly handled the Subject when used with ``bcc_batch_mode`` resulting in E_WARNING messages and an empty Subject.
- Fixed a bug (#2234) - :doc:`Query Builder <database/query_builder>` didn't reset JOIN cache for write-type queries.
- Fixed a bug (#2298) - :doc:`Database Results <database/results>` method `next_row()` kept returning the last row, allowing for infinite loops.
diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst
index 7917d3239..79bd9b459 100644
--- a/user_guide_src/source/general/common_functions.rst
+++ b/user_guide_src/source/general/common_functions.rst
@@ -31,7 +31,7 @@ version of PHP is lower than the supplied version number.
is_really_writable()
====================
-.. php:function:: is_really_writeable($file)
+.. php:function:: is_really_writable($file)
:param string $file: File path
:returns: bool
diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst
index 8c941aadb..441cedb80 100644
--- a/user_guide_src/source/general/errors.rst
+++ b/user_guide_src/source/general/errors.rst
@@ -18,6 +18,15 @@ procedural interfaces that are available globally throughout the
application. This approach permits error messages to get triggered
without having to worry about class/function scoping.
+CodeIgniter also returns a status code whenever a portion of the core
+calls ``exit()``. This exit status code is separate from the HTTP status
+code, and serves as a notice to other processes that may be watching of
+whether the script completed successfully, or if not, what kind of
+problem it encountered that caused it to abort. These values are
+defined in *application/config/constants.php*. While exit status codes
+are most useful in CLI settings, returning the proper code helps server
+software keep track of your scripts and the health of your application.
+
The following functions let you generate errors:
show_error()
@@ -36,7 +45,12 @@ following error template::
application/errors/error_general.php
The optional parameter ``$status_code`` determines what HTTP status
-code should be sent with the error.
+code should be sent with the error. If ``$status_code`` is less than 100,
+the HTTP status code will be set to 500, and the exit status code will
+be set to ``$status_code + EXIT__AUTO_MIN``. If that value is larger than
+``EXIT__AUTO_MAX``, or if ``$status_code`` is 100 or higher, the exit
+status code will be set to ``EXIT_ERROR``. You can check in
+*application/config/constants.php* for more detail.
show_404()
==========
@@ -53,8 +67,9 @@ the following error template::
application/errors/error_404.php
The function expects the string passed to it to be the file path to the
-page that isn't found. Note that CodeIgniter automatically shows 404
-messages if controllers are not found.
+page that isn't found. The exit status code will be set to ``EXIT_UNKNOWN_FILE``.
+Note that CodeIgniter automatically shows 404 messages if controllers are
+not found.
CodeIgniter automatically logs any ``show_404()`` calls. Setting the
optional second parameter to FALSE will skip logging.
diff --git a/user_guide_src/source/general/reserved_names.rst b/user_guide_src/source/general/reserved_names.rst
index d91292363..ccc17d61b 100644
--- a/user_guide_src/source/general/reserved_names.rst
+++ b/user_guide_src/source/general/reserved_names.rst
@@ -25,15 +25,21 @@ your controller any of these:
Functions
---------
+- :php:func:`is_php()`
- :php:func:`is_really_writable()`
- ``load_class()``
+- ``is_loaded()``
- ``get_config()``
- :php:func:`config_item()`
- :php:func:`show_error()`
- :php:func:`show_404()`
- :php:func:`log_message()`
+- :php:func:`set_status_header()`
- :php:func:`get_mimes()`
- :php:func:`html_escape()`
+- :php:func:`remove_invisible_characters()`
+- :php:func:`is_https()`
+- :php:func:`function_usable()`
- :php:func:`get_instance()`
- ``_exception_handler()``
- ``_stringify_attributes()``
@@ -66,4 +72,14 @@ Constants
- FOPEN_WRITE_CREATE
- FOPEN_READ_WRITE_CREATE
- FOPEN_WRITE_CREATE_STRICT
-- FOPEN_READ_WRITE_CREATE_STRICT \ No newline at end of file
+- FOPEN_READ_WRITE_CREATE_STRICT
+- EXIT_SUCCESS
+- EXIT_ERROR
+- EXIT_CONFIG
+- EXIT_UNKNOWN_FILE
+- EXIT_UNKNOWN_CLASS
+- EXIT_UNKNOWN_METHOD
+- EXIT_USER_INPUT
+- EXIT_DATABASE
+- EXIT__AUTO_MIN
+- EXIT__AUTO_MAX \ No newline at end of file