From f4a4bd8fac188ebc9cda822ffc811c218fd92b45 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Thu, 20 Oct 2011 12:18:42 -0500 Subject: adding new license file (OSL 3.0) and updating readme to ReST added notice of license to all source files. OSL to all except the few files we ship inside of the application folder, those are AFL. Updated license in user guide. incrementing next dev version to 3.0 due to licensing change --- system/core/Exceptions.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 869739a5a..ead8d814e 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -4,10 +4,22 @@ * * An open source application development framework for PHP 5.1.6 or newer * + * NOTICE OF LICENSE + * + * Licensed under the Open Software License version 3.0 + * + * This source file is subject to the Open Software License (OSL 3.0) that is + * bundled with this package in the files license.txt / license.rst. It is + * also available through the world wide web at this URL: + * http://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to obtain it + * through the world wide web, please send an email to + * licensing@ellislab.com so we can send you a copy immediately. + * * @package CodeIgniter - * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. - * @license http://codeigniter.com/user_guide/license.html + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 * @filesource @@ -21,7 +33,7 @@ * @package CodeIgniter * @subpackage Libraries * @category Exceptions - * @author ExpressionEngine Dev Team + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/libraries/exceptions.html */ class CI_Exceptions { -- cgit v1.2.3-24-g4f1b From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index ead8d814e..3737f2930 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 7ac33d7a615f9b5e27fe92a0a91c4ebfb19faad3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 19:39:39 +0200 Subject: Improve core Controller & Exceptions libraries --- system/core/Exceptions.php | 83 +++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 48 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 3737f2930..9b672ac54 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -1,13 +1,13 @@ - 'Error', - E_WARNING => 'Warning', - E_PARSE => 'Parsing Error', - E_NOTICE => 'Notice', - E_CORE_ERROR => 'Core Error', - E_CORE_WARNING => 'Core Warning', - E_COMPILE_ERROR => 'Compile Error', - E_COMPILE_WARNING => 'Compile Warning', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice' - ); + public $levels = array( + E_ERROR => 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parsing Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice' + ); - - /** - * Constructor - */ public function __construct() { $this->ob_level = ob_get_level(); - // Note: Do not log messages from this constructor. + // Note: Do not log messages from this constructor. } // -------------------------------------------------------------------- @@ -89,17 +84,15 @@ class CI_Exceptions { * * This function logs PHP generated error messages * - * @access private * @param string the error severity * @param string the error string * @param string the error filepath * @param string the error line number - * @return string + * @return void */ - function log_exception($severity, $message, $filepath, $line) + public function log_exception($severity, $message, $filepath, $line) { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; - log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } @@ -108,15 +101,14 @@ class CI_Exceptions { /** * 404 Page Not Found Handler * - * @access private * @param string the page * @param bool log error yes/no * @return string */ - function show_404($page = '', $log_error = TRUE) + public function show_404($page = '', $log_error = TRUE) { - $heading = "404 Page Not Found"; - $message = "The page you requested was not found."; + $heading = '404 Page Not Found'; + $message = 'The page you requested was not found.'; // By default we log this, but allow a dev to skip it if ($log_error) @@ -137,14 +129,13 @@ class CI_Exceptions { * (either as a string or an array) and displays * it using the specified template. * - * @access private * @param string the heading * @param string the message * @param string the template name * @param int the status code * @return string */ - function show_error($heading, $message, $template = 'error_general', $status_code = 500) + public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { set_status_header($status_code); @@ -155,7 +146,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.$template.'.php'); + include(APPPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -166,7 +157,6 @@ class CI_Exceptions { /** * Native PHP error handler * - * @access private * @param string the error severity * @param string the error string * @param string the error filepath @@ -176,8 +166,7 @@ class CI_Exceptions { function show_php_error($severity, $message, $filepath, $line) { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; - - $filepath = str_replace("\\", "/", $filepath); + $filepath = str_replace('\\', '/', $filepath); // For safety reasons we do not show the full file path if (FALSE !== strpos($filepath, '/')) @@ -191,15 +180,13 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/error_php.php'); + include(APPPATH.'errors'.DIRECTORY_SEPARATOR.'error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; } - } -// END Exceptions Class /* End of file Exceptions.php */ -/* Location: ./system/core/Exceptions.php */ \ No newline at end of file +/* Location: ./system/core/Exceptions.php */ -- cgit v1.2.3-24-g4f1b From fdc63828a876e87742380a4ae077e43f514320b8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 21:17:46 +0200 Subject: Revert DIRECTORY_SEPARATOR changes --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 9b672ac54..bf9901252 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -146,7 +146,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include(APPPATH.'errors/'.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -180,7 +180,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors'.DIRECTORY_SEPARATOR.'error_php.php'); + include(APPPATH.'errors/'.'error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index bf9901252..d7282b1f3 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From c6a68e04169802c8aa82e41634ce350eafd1ec1e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 14:30:10 +0300 Subject: Add visibility declarations where they remain missing --- system/core/Exceptions.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index d7282b1f3..f36b31598 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Exceptions Class * @@ -163,7 +161,7 @@ class CI_Exceptions { * @param string the error line number * @return string */ - function show_php_error($severity, $message, $filepath, $line) + public function show_php_error($severity, $message, $filepath, $line) { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; $filepath = str_replace('\\', '/', $filepath); @@ -189,4 +187,4 @@ class CI_Exceptions { } /* End of file Exceptions.php */ -/* Location: ./system/core/Exceptions.php */ +/* Location: ./system/core/Exceptions.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From ad4750509885ad5bb368fc308f86d8c06d45b15c Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 19 Apr 2012 13:21:06 -0400 Subject: Normalize comments in core files --- system/core/Exceptions.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index f36b31598..dd5841333 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -36,12 +36,6 @@ */ class CI_Exceptions { - public $action; - public $severity; - public $message; - public $filename; - public $line; - /** * Nesting level of the output buffering mechanism * @@ -69,6 +63,9 @@ class CI_Exceptions { E_STRICT => 'Runtime Notice' ); + /** + * Initialize execption class + */ public function __construct() { $this->ob_level = ob_get_level(); -- cgit v1.2.3-24-g4f1b From 40403d21274d5e0792c7ab816ad984d6387d5c20 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 19 Apr 2012 16:38:50 -0400 Subject: Additional formatting fixes --- system/core/Exceptions.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index dd5841333..f55f9fcba 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -49,19 +49,19 @@ class CI_Exceptions { * @var array */ public $levels = array( - E_ERROR => 'Error', - E_WARNING => 'Warning', - E_PARSE => 'Parsing Error', - E_NOTICE => 'Notice', - E_CORE_ERROR => 'Core Error', - E_CORE_WARNING => 'Core Warning', - E_COMPILE_ERROR => 'Compile Error', - E_COMPILE_WARNING => 'Compile Warning', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice' - ); + E_ERROR => 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parsing Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice' + ); /** * Initialize execption class -- cgit v1.2.3-24-g4f1b From 48a7fbbeb53e82e9298036d40c42ec2564699ed0 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 23 Apr 2012 11:58:16 -0400 Subject: Use tabs to separate class properties --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index f55f9fcba..2e9f0c766 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -39,14 +39,14 @@ class CI_Exceptions { /** * Nesting level of the output buffering mechanism * - * @var int + * @var int */ public $ob_level; /** * List if available error levels * - * @var array + * @var array */ public $levels = array( E_ERROR => 'Error', -- cgit v1.2.3-24-g4f1b From 09069ddcecde9a0c66e41087e816567d420eb750 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 14 May 2012 15:21:33 -0400 Subject: Move errors to views folder --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 2e9f0c766..f9618044e 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -141,7 +141,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.$template.'.php'); + include(APPPATH.'views/errors/'.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -175,7 +175,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.'error_php.php'); + include(APPPATH.'views/errors/error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From 92ebfb65ac044f5c2e6d88fba137253854cf1b94 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 12:49:24 +0300 Subject: Cleanup the core classes --- system/core/Exceptions.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 2e9f0c766..965a717ad 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -65,6 +65,8 @@ class CI_Exceptions { /** * Initialize execption class + * + * @return void */ public function __construct() { @@ -87,7 +89,7 @@ class CI_Exceptions { */ public function log_exception($severity, $message, $filepath, $line) { - $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } @@ -127,14 +129,14 @@ class CI_Exceptions { * @param string the heading * @param string the message * @param string the template name - * @param int the status code + * @param int the status code * @return string */ public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { set_status_header($status_code); - $message = '

'.implode('

', ( ! is_array($message)) ? array($message) : $message).'

'; + $message = '

'.implode('

', is_array($message) ? $message : array($message)).'

'; if (ob_get_level() > $this->ob_level + 1) { @@ -160,7 +162,7 @@ class CI_Exceptions { */ public function show_php_error($severity, $message, $filepath, $line) { - $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; $filepath = str_replace('\\', '/', $filepath); // For safety reasons we do not show the full file path @@ -175,7 +177,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.'error_php.php'); + include(APPPATH.'errors/error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From 0d2c06ea1d96ea3f35dd1e7856977a24cec43233 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 12 Jun 2012 02:33:45 +0300 Subject: Change file permissions for system/core/*.php and system/database/DB.php so that they don't differ from the rest --- system/core/Exceptions.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 system/core/Exceptions.php (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php old mode 100755 new mode 100644 -- cgit v1.2.3-24-g4f1b From c59d25dcd86b0743ca6777fa922efbad308d7d3f Mon Sep 17 00:00:00 2001 From: Nicholas Avenell Date: Sun, 24 Jun 2012 10:57:18 +0000 Subject: Use the VIEWPATH constant, instead of assuming the user hasn't moved them --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 8c32085fe..bd9178dbd 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -143,7 +143,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'views/errors/'.$template.'.php'); + include(VIEWPATH.'errors/'.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -177,7 +177,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'views/errors/error_php.php'); + include(VIEWPATH.'errors/error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From 3e9d2b8ae82948de3c83bd5a50151949f6e6ca90 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 27 Oct 2012 14:28:51 +0300 Subject: Docblock improvements --- system/core/Exceptions.php | 48 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index bd9178dbd..c0caf2e7d 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -64,7 +64,7 @@ class CI_Exceptions { ); /** - * Initialize execption class + * Class constructor * * @return void */ @@ -79,12 +79,12 @@ class CI_Exceptions { /** * Exception Logger * - * This function logs PHP generated error messages + * Logs PHP generated error messages * - * @param string the error severity - * @param string the error string - * @param string the error filepath - * @param string the error line number + * @param int $severity Log level + * @param string $message Error message + * @param string $filepath File path + * @param int $line Line number * @return void */ public function log_exception($severity, $message, $filepath, $line) @@ -96,11 +96,13 @@ class CI_Exceptions { // -------------------------------------------------------------------- /** - * 404 Page Not Found Handler + * 404 Error Handler * - * @param string the page - * @param bool log error yes/no - * @return string + * @uses CI_Exceptions::show_error() + * + * @param string $page Page URI + * @param bool $log_error Whether to log the error + * @return void */ public function show_404($page = '', $log_error = TRUE) { @@ -122,15 +124,15 @@ class CI_Exceptions { /** * General Error Page * - * This function takes an error message as input - * (either as a string or an array) and displays - * it using the specified template. + * Takes an error message as input (either as a string or an array) + * and displays it using the specified template. + * + * @param string $heading Page heading + * @param string|string[] $message Error message + * @param string $template Template name + * @param int $statis_code (default: 500) * - * @param string the heading - * @param string the message - * @param string the template name - * @param int the status code - * @return string + * @return string Error page output */ public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { @@ -154,11 +156,11 @@ class CI_Exceptions { /** * Native PHP error handler * - * @param string the error severity - * @param string the error string - * @param string the error filepath - * @param string the error line number - * @return string + * @param int $severity Error level + * @param string $message Error message + * @param string $filepath File path + * @param int $line Line number + * @return string Error page output */ public function show_php_error($severity, $message, $filepath, $line) { -- cgit v1.2.3-24-g4f1b From 5232ba07752ffa783d03754c3a869d9f73ccae69 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 27 Oct 2012 15:25:05 +0300 Subject: Docblock improvements to the Config library and remove CI_Config::_assign_to_config() Existance of _assign_to_config() is pointless as this method consists just of a foreach calling CI_Config::set_item() and is only called by CodeIgniter.php - moved that foreach() in there instead. --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index c0caf2e7d..556257729 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -130,7 +130,7 @@ class CI_Exceptions { * @param string $heading Page heading * @param string|string[] $message Error message * @param string $template Template name - * @param int $statis_code (default: 500) + * @param int $status_code (default: 500) * * @return string Error page output */ -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/core/Exceptions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 556257729..ced65ece4 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -1,4 +1,4 @@ - Date: Tue, 1 Jan 2013 08:16:53 +0200 Subject: [ci skip] Happy new year --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index ced65ece4..e6023e73b 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b 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/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') 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); } // -------------------------------------------------------------------- -- 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/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') 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); } // -------------------------------------------------------------------- -- 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/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') 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); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 838c9a96f645aac24daa31285efa1051535c4219 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 13 Sep 2013 14:05:13 +0300 Subject: Drop the unused parameter from log_message() / CI_Log::write_log() --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 9c68d06a5..d7e5ed4d9 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -91,7 +91,7 @@ class CI_Exceptions { public function log_exception($severity, $message, $filepath, $line) { $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; - log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); + log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 29947ee882a8d519d62ca9061ed6513cedfb1930 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 12 Nov 2013 18:36:46 +0200 Subject: Add CLI error templates and only send HTTP status headers for non-CLI requests (issue #1743) --- system/core/Exceptions.php | 53 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index d7e5ed4d9..809dc027a 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -91,7 +91,7 @@ class CI_Exceptions { public function log_exception($severity, $message, $filepath, $line) { $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; - log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line); + log_message('error', 'Severity: '.$severity.' --> '.$message.' '.$filepath.' '.$line); } // -------------------------------------------------------------------- @@ -107,13 +107,21 @@ class CI_Exceptions { */ public function show_404($page = '', $log_error = TRUE) { - $heading = '404 Page Not Found'; - $message = 'The page you requested was not found.'; + if (is_cli()) + { + $heading = 'Not Found'; + $message = 'The controller/method pair you requested was not found.'; + } + else + { + $heading = '404 Page Not Found'; + $message = 'The page you requested was not found.'; + } // By default we log this, but allow a dev to skip it if ($log_error) { - log_message('error', '404 Page Not Found --> '.$page); + log_message('error', $heading.': '.$page); } echo $this->show_error($heading, $message, 'error_404', 404); @@ -137,16 +145,24 @@ class CI_Exceptions { */ public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { - set_status_header($status_code); - - $message = '

'.implode('

', is_array($message) ? $message : array($message)).'

'; + if (is_cli()) + { + $message = "\t".(is_array($message) ? implode("\n\t", $message) : $message); + $template = 'cli'.DIRECTORY_SEPARATOR.$template; + } + else + { + set_status_header($status_code); + $message = '

'.(is_array($message) ? implode('

', $message) : $message).'

'; + $template = 'html'.DIRECTORY_SEPARATOR.$template; + } if (ob_get_level() > $this->ob_level + 1) { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors/'.$template.'.php'); + include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -166,13 +182,22 @@ class CI_Exceptions { public function show_php_error($severity, $message, $filepath, $line) { $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; - $filepath = str_replace('\\', '/', $filepath); - // For safety reasons we do not show the full file path - if (FALSE !== strpos($filepath, '/')) + // For safety reasons we don't show the full file path in non-CLI requests + if ( ! is_cli()) + { + $filepath = str_replace('\\', '/', $filepath); + if (FALSE !== strpos($filepath, '/')) + { + $x = explode('/', $filepath); + $filepath = $x[count($x)-2].'/'.end($x); + } + + $template = 'html'.DIRECTORY_SEPARATOR.'error_php'; + } + else { - $x = explode('/', $filepath); - $filepath = $x[count($x)-2].'/'.end($x); + $template = 'cli'.DIRECTORY_SEPARATOR.'error_php'; } if (ob_get_level() > $this->ob_level + 1) @@ -180,7 +205,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors/error_php.php'); + include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From 871754af60251993d640981e107d2def5f2db396 Mon Sep 17 00:00:00 2001 From: darwinel Date: Tue, 11 Feb 2014 17:34:57 +0100 Subject: 2013 > 2014 Update copyright notices from 2013 to 2014. And update one calendar example in user_guide from year 2013/2014 to 2014/2015. --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 809dc027a..54a5bc48b 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 7cf682abf46bcaa112b63c500a884ba25c0dd8b3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 13 Mar 2014 14:55:45 +0200 Subject: Partially revert PR #2190 The core shouldn't depend on constants that are not defined by itself --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 54a5bc48b..041869641 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -125,7 +125,7 @@ class CI_Exceptions { } echo $this->show_error($heading, $message, 'error_404', 404); - exit(EXIT_UNKNOWN_FILE); + exit(4); // EXIT_UNKNOWN_FILE } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From cdf3dfae82acf2dde5db1adb3b87c642a894d4d4 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sat, 12 Apr 2014 07:33:42 +0200 Subject: Make the error templates path configurable --- system/core/Exceptions.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 041869641..398459d54 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -44,6 +44,13 @@ class CI_Exceptions { */ public $ob_level; + /** + * Path to the error templates + * + * @var string + */ + protected $_templates_path; + /** * List if available error levels * @@ -73,6 +80,12 @@ class CI_Exceptions { { $this->ob_level = ob_get_level(); // Note: Do not log messages from this constructor. + + $config =& get_config(); + + $this->_templates_path = (isset($config['error_templates_path']) && $config['error_templates_path'] !== '') + ? $config['error_templates_path'] + : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } // -------------------------------------------------------------------- @@ -162,7 +175,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include($this->_templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -205,7 +218,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include($this->_templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From 511a6b8eb67e34820c1b9446cfc8891b52df90c7 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Apr 2014 14:33:55 +0200 Subject: Rename config item "error_templates_path" to "error_views_path" --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 398459d54..0c247f916 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -83,8 +83,8 @@ class CI_Exceptions { $config =& get_config(); - $this->_templates_path = (isset($config['error_templates_path']) && $config['error_templates_path'] !== '') - ? $config['error_templates_path'] + $this->_templates_path = (isset($config['error_views_path']) && $config['error_views_path'] !== '') + ? $config['error_views_path'] : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } -- cgit v1.2.3-24-g4f1b From 08ea83bb19146eab8e792acc35f02f6e8d055894 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Apr 2014 14:34:06 +0200 Subject: Different method for handling "error_views_path" config item --- system/core/Exceptions.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 0c247f916..5bcb7c1c5 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -44,13 +44,6 @@ class CI_Exceptions { */ public $ob_level; - /** - * Path to the error templates - * - * @var string - */ - protected $_templates_path; - /** * List if available error levels * @@ -80,12 +73,6 @@ class CI_Exceptions { { $this->ob_level = ob_get_level(); // Note: Do not log messages from this constructor. - - $config =& get_config(); - - $this->_templates_path = (isset($config['error_views_path']) && $config['error_views_path'] !== '') - ? $config['error_views_path'] - : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } // -------------------------------------------------------------------- @@ -158,6 +145,10 @@ class CI_Exceptions { */ public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { + $templates_path = config_item('error_views_path') + ? config_item('error_views_path') + : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + if (is_cli()) { $message = "\t".(is_array($message) ? implode("\n\t", $message) : $message); @@ -175,7 +166,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include($this->_templates_path.$template.'.php'); + include($templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -194,6 +185,10 @@ class CI_Exceptions { */ public function show_php_error($severity, $message, $filepath, $line) { + $templates_path = config_item('error_views_path') + ? config_item('error_views_path') + : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; // For safety reasons we don't show the full file path in non-CLI requests @@ -218,7 +213,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include($this->_templates_path.$template.'.php'); + include($templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From d5ce50885f9eda623bb681cb77dd667c20bec4fb Mon Sep 17 00:00:00 2001 From: vlakoff Date: Fri, 25 Apr 2014 10:13:04 +0200 Subject: Minor fixes --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 5bcb7c1c5..cb4bc3cd6 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -45,7 +45,7 @@ class CI_Exceptions { public $ob_level; /** - * List if available error levels + * List of available error levels * * @var array */ -- cgit v1.2.3-24-g4f1b From d444d445ed0458a352ecb9ff79ffd158677ee805 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 6 Oct 2014 00:00:08 +0300 Subject: config_item() to return NULL instead of FALSE for non-existing items Close #3001 Close #3232 Related: #3244 --- system/core/Exceptions.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index cb4bc3cd6..49c2217c9 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -145,9 +145,11 @@ class CI_Exceptions { */ public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { - $templates_path = config_item('error_views_path') - ? config_item('error_views_path') - : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + $templates_path = config_item('error_views_path'); + if (empty($templates_path)) + { + $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + } if (is_cli()) { @@ -185,9 +187,11 @@ class CI_Exceptions { */ public function show_php_error($severity, $message, $filepath, $line) { - $templates_path = config_item('error_views_path') - ? config_item('error_views_path') - : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + $templates_path = config_item('error_views_path'); + if (empty($templates_path)) + { + $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + } $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; -- cgit v1.2.3-24-g4f1b From bdb96ca1b1dbfc1791172fd169d7751cbc4d7d55 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Oct 2014 00:13:31 +0200 Subject: [ci skip] Switch to MIT license; close #3293 --- system/core/Exceptions.php | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 49c2217c9..6324fba2b 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -4,24 +4,35 @@ * * An open source application development framework for PHP 5.2.4 or newer * - * NOTICE OF LICENSE + * This content is released under the MIT License (MIT) * - * Licensed under the Open Software License version 3.0 + * Copyright (c) 2014, British Columbia Institute of Technology * - * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is - * also available through the world wide web at this URL: - * http://opensource.org/licenses/OSL-3.0 - * If you did not receive a copy of the license and are unable to obtain it - * through the world wide web, please send an email to - * licensing@ellislab.com so we can send you a copy immediately. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * @package CodeIgniter - * @author EllisLab Dev Team + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - * @link http://codeigniter.com - * @since Version 1.0 + * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); -- cgit v1.2.3-24-g4f1b From 4b838af40d77684539dd40461bd92e6e453fe675 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Oct 2014 23:46:45 +0200 Subject: Add a real exception handler Close #1590 Close #3200 --- system/core/Exceptions.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 6324fba2b..0531a4e92 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -187,6 +187,44 @@ class CI_Exceptions { // -------------------------------------------------------------------- + public function show_exception(Exception $exception) + { + $templates_path = config_item('error_views_path'); + if (empty($templates_path)) + { + $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + } + + $message = $exception->getMessage(); + if (empty($message)) + { + $message = '(null)'; + } + + if (is_cli()) + { + $templates_path .= 'cli'.DIRECTORY_SEPARATOR; + } + else + { + set_status_header(500); + $templates_path .= 'html'.DIRECTORY_SEPARATOR; + } + + if (ob_get_level() > $this->ob_level + 1) + { + ob_end_flush(); + } + + ob_start(); + include($templates_path.'error_exception.php'); + $buffer = ob_get_contents(); + ob_end_clean(); + echo $buffer; + } + + // -------------------------------------------------------------------- + /** * Native PHP error handler * -- cgit v1.2.3-24-g4f1b From fe9309d22c1b088f5363954d6dac013c8c955894 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Jan 2015 17:48:58 +0200 Subject: Bulk (mostly documentation) update - Remove PHP version from license notices - Bump year number in copyright notices - Recommend PHP 5.4 or newer to be used - Tell Travis-CI to test on PHP 5.3.0 instead of the latest 5.3 version Related: #3450 --- system/core/Exceptions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 0531a4e92..550e03b78 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 4cbe463b4c442e0e2dae2f43565e77f7ac5ecb86 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 21 Jan 2015 22:56:22 +0100 Subject: Remove closing blocks at end of PHP files --- system/core/Exceptions.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 550e03b78..fc25f57e6 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -273,6 +273,3 @@ class CI_Exceptions { } } - -/* End of file Exceptions.php */ -/* Location: ./system/core/Exceptions.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 84f24c23baf5ea45c30c4ab3cbc57cd846ea0f56 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 Sep 2015 15:17:28 +0300 Subject: Fix #4137 --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index fc25f57e6..d8f62c0fe 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -187,7 +187,7 @@ class CI_Exceptions { // -------------------------------------------------------------------- - public function show_exception(Exception $exception) + public function show_exception($exception) { $templates_path = config_item('error_views_path'); if (empty($templates_path)) -- cgit v1.2.3-24-g4f1b From 125ef4751080a2118cb203357d77687699e3eb25 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:33:00 +0200 Subject: [ci skip] Bump year to 2016 --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index d8f62c0fe..29a285166 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology + * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From bd202c91b0e9cf0a8c93bcaa71df9574f5909346 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:50:18 +0200 Subject: [ci skip] Update codeigniter.com links to https --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 29a285166..e3270d609 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -31,7 +31,7 @@ * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com + * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Libraries * @category Exceptions * @author EllisLab Dev Team - * @link http://codeigniter.com/user_guide/libraries/exceptions.html + * @link https://codeigniter.com/user_guide/libraries/exceptions.html */ class CI_Exceptions { -- cgit v1.2.3-24-g4f1b From 1924e879b165fb119847a49a7a5eab2f28295fa2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:55:34 +0200 Subject: [ci skip] Update ellislab.com links to https too --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index e3270d609..a1c6a1970 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -28,7 +28,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com -- cgit v1.2.3-24-g4f1b From 4ffe6345690f81872d0937e562faaf75f3185b6a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 21 Oct 2016 16:30:31 +0300 Subject: Fix #4865 --- system/core/Exceptions.php | 1 - 1 file changed, 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index a1c6a1970..4e10f2831 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -207,7 +207,6 @@ class CI_Exceptions { } else { - set_status_header(500); $templates_path .= 'html'.DIRECTORY_SEPARATOR; } -- cgit v1.2.3-24-g4f1b From da60e9bc66ec90970fbd2dfd08b0a6e66b9f5f5f Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/core/Exceptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 4e10f2831..47d153f49 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From ee9d428171dc201f51eaffdb62616312915681ff Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 5 Jun 2017 10:44:37 +0300 Subject: [ci skip] Merge pull request #5143 from TysonAndre/misc-phpdoc-nits Fix misc inconsistencies between code and doc comments --- system/core/Exceptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Exceptions.php') diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 47d153f49..526909602 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -231,7 +231,7 @@ class CI_Exceptions { * @param string $message Error message * @param string $filepath File path * @param int $line Line number - * @return string Error page output + * @return void */ public function show_php_error($severity, $message, $filepath, $line) { -- cgit v1.2.3-24-g4f1b