Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
diff --git a/index.php b/index.php
index ad98013..aa1df44 100644
--- a/index.php
+++ b/index.php
@@ -52,20 +52,22 @@
  * By default development will show errors but testing and live will hide them.
  */
 
-if (defined('ENVIRONMENT'))
+switch (ENVIRONMENT)
 {
-	switch (ENVIRONMENT)
-	{
-		case 'development':
-			error_reporting(-1);
-		break;
-		case 'testing':
-		case 'production':
-			error_reporting(0);
-		break;
-		default:
-			exit('The application environment is not set correctly.');
-	}
+	case 'development':
+		error_reporting(-1);
+		ini_set('display_errors', 1);
+	break;
+
+	case 'testing':
+	case 'production':
+		error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
+		ini_set('display_errors', 0);
+	break;
+
+	default:
+		header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
+		exit('The application environment is not set correctly.');
 }
 
 /*
@@ -268,4 +270,4 @@
 require_once BASEPATH.'core/CodeIgniter.php';
 
 /* End of file index.php */
-/* Location: ./index.php */
\ No newline at end of file
+/* Location: ./index.php */
diff --git a/system/core/Common.php b/system/core/Common.php
index c309d41..06b1622 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -172,7 +172,7 @@
 		if ($name === FALSE)
 		{
 			// Note: We use exit() rather then show_error() in order to avoid a
-			// self-referencing loop with the Excptions class
+			// self-referencing loop with the Exceptions class
 			set_status_header(503);
 			exit('Unable to locate the specified class: '.$class.'.php');
 		}
@@ -526,7 +526,8 @@
 
 		// Should we display the error? We'll get the current error_reporting
 		// level and add its bits with the severity bits to find out.
-		if (($severity & error_reporting()) === $severity)
+		// And respect display_errors
+		if (($severity & error_reporting()) === $severity && (bool) ini_get('display_errors') === TRUE)
 		{
 			$_error->show_php_error($severity, $message, $filepath, $line);
 		}
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index b074c58..d17b046 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -34,7 +34,6 @@
  */
 class CI_DB_odbc_forge extends CI_DB_forge {
 
-	protected $_drop_database	= 'DROP DATABASE %s';
 	protected $_drop_table		= 'DROP TABLE %s';
 
 	/**
diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php
index 5396282..34a6ee4 100644
--- a/system/database/drivers/pdo/pdo_forge.php
+++ b/system/database/drivers/pdo/pdo_forge.php
@@ -34,7 +34,6 @@
  */
 class CI_DB_pdo_forge extends CI_DB_forge {
 
-	protected $_drop_database	= 'DROP DATABASE %s';
 	protected $_drop_table		= 'DROP TABLE %s';
 
 	/**
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 4676b2a..a4383c9 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -32,7 +32,7 @@
  * @subpackage	Helpers
  * @category	Helpers
  * @author		EllisLab Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/xml_helper.html
+ * @link		http://codeigniter.com/user_guide/helpers/captcha_helper.html
  */
 
 // ------------------------------------------------------------------------
@@ -186,7 +186,6 @@
 			}
 		}
 
-
 		// Create the border
 		imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
 
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 7270ee3..3834d48 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -32,7 +32,7 @@
  * @subpackage	Helpers
  * @category	Helpers
  * @author		EllisLab Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/file_helpers.html
+ * @link		http://codeigniter.com/user_guide/helpers/file_helper.html
  */
 
 // ------------------------------------------------------------------------
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index fec4a1a..166fef0 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -32,7 +32,7 @@
  * @subpackage	Helpers
  * @category	Helpers
  * @author		EllisLab Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/xml_helper.html
+ * @link		http://codeigniter.com/user_guide/helpers/path_helper.html
  */
 
 // ------------------------------------------------------------------------
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 0e8e9f9..5ecc960 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -125,7 +125,7 @@
 	 */
 	function encode_php_tags($str)
 	{
-		return str_replace(array('<?', '?>'),  array('&lt;?', '?&gt;'), $str);
+		return str_replace(array('<?', '?>'), array('&lt;?', '?&gt;'), $str);
 	}
 }
 
diff --git a/system/language/english/calendar_lang.php b/system/language/english/calendar_lang.php
index 48939d4..b357ca7 100644
--- a/system/language/english/calendar_lang.php
+++ b/system/language/english/calendar_lang.php
@@ -71,6 +71,5 @@
 $lang['cal_november']	= "November";
 $lang['cal_december']	= "December";
 
-
 /* End of file calendar_lang.php */
 /* Location: ./system/language/english/calendar_lang.php */
\ No newline at end of file
diff --git a/system/language/english/date_lang.php b/system/language/english/date_lang.php
index 38532b7..229d33d 100644
--- a/system/language/english/date_lang.php
+++ b/system/language/english/date_lang.php
@@ -81,6 +81,5 @@
 $lang['UP13']	= '(UTC +13:00) Samoa Time Zone, Phoenix Islands Time, Tonga';
 $lang['UP14']	= '(UTC +14:00) Line Islands';
 
-
 /* End of file date_lang.php */
 /* Location: ./system/language/english/date_lang.php */
\ No newline at end of file
diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php
index 95a16d1..1d736ec 100644
--- a/system/language/english/email_lang.php
+++ b/system/language/english/email_lang.php
@@ -30,9 +30,9 @@
 $lang['email_attachment_missing'] = "Unable to locate the following email attachment: %s";
 $lang['email_attachment_unreadable'] = "Unable to open this attachment: %s";
 $lang['email_no_recipients'] = "You must include recipients: To, Cc, or Bcc";
-$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail().  Your server might not be configured to send mail using this method.";
-$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail.  Your server might not be configured to send mail using this method.";
-$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP.  Your server might not be configured to send mail using this method.";
+$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.";
+$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.";
+$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.";
 $lang['email_sent'] = "Your message has been successfully sent using the following protocol: %s";
 $lang['email_no_socket'] = "Unable to open a socket to Sendmail. Please check settings.";
 $lang['email_no_hostname'] = "You did not specify a SMTP hostname.";
@@ -44,6 +44,5 @@
 $lang['email_smtp_data_failure'] = "Unable to send data: %s";
 $lang['email_exit_status'] = "Exit status code: %s";
 
-
 /* End of file email_lang.php */
 /* Location: ./system/language/english/email_lang.php */
\ No newline at end of file
diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php
index eb4624e..149a62d 100644
--- a/system/language/english/form_validation_lang.php
+++ b/system/language/english/form_validation_lang.php
@@ -51,6 +51,5 @@
 $lang['greater_than']			= "The %s field must contain a number greater than %s.";
 $lang['greater_than_equal_to']	= "The %s field must contain a number greater than or equal to %s.";
 
-
 /* End of file form_validation_lang.php */
-/* Location: ./system/language/english/form_validation_lang.php */
+/* Location: ./system/language/english/form_validation_lang.php */
\ No newline at end of file
diff --git a/system/language/english/ftp_lang.php b/system/language/english/ftp_lang.php
index d00126b..6a1f1bc 100644
--- a/system/language/english/ftp_lang.php
+++ b/system/language/english/ftp_lang.php
@@ -38,6 +38,5 @@
 $lang['ftp_unable_to_delete']		= "Unable to delete the file.";
 $lang['ftp_unable_to_move']			= "Unable to move the file. Please make sure the destination directory exists.";
 
-
 /* End of file ftp_lang.php */
 /* Location: ./system/language/english/ftp_lang.php */
\ No newline at end of file
diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php
index 67a36e1..7090eb5 100644
--- a/system/language/english/imglib_lang.php
+++ b/system/language/english/imglib_lang.php
@@ -29,21 +29,20 @@
 $lang['imglib_gd_required'] = "The GD image library is required for this feature.";
 $lang['imglib_gd_required_for_props'] = "Your server must support the GD image library in order to determine the image properties.";
 $lang['imglib_unsupported_imagecreate'] = "Your server does not support the GD function required to process this type of image.";
-$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions.  You may have to use JPG or PNG images instead.";
+$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead.";
 $lang['imglib_jpg_not_supported'] = "JPG images are not supported.";
 $lang['imglib_png_not_supported'] = "PNG images are not supported.";
 $lang['imglib_jpg_or_png_required'] = "The image resize protocol specified in your preferences only works with JPEG or PNG image types.";
-$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file.  Please make sure your file directory is writable.";
+$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file. Please make sure your file directory is writable.";
 $lang['imglib_rotate_unsupported'] = "Image rotation does not appear to be supported by your server.";
-$lang['imglib_libpath_invalid'] = "The path to your image library is not correct.  Please set the correct path in your image preferences.";
-$lang['imglib_image_process_failed'] = "Image processing failed.  Please verify that your server supports the chosen protocol and that the path to your image library is correct.";
+$lang['imglib_libpath_invalid'] = "The path to your image library is not correct. Please set the correct path in your image preferences.";
+$lang['imglib_image_process_failed'] = "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct.";
 $lang['imglib_rotation_angle_required'] = "An angle of rotation is required to rotate the image.";
 $lang['imglib_writing_failed_gif'] = "GIF image.";
 $lang['imglib_invalid_path'] = "The path to the image is not correct.";
 $lang['imglib_copy_failed'] = "The image copy routine failed.";
 $lang['imglib_missing_font'] = "Unable to find a font to use.";
-$lang['imglib_save_failed'] = "Unable to save the image.  Please make sure the image and file directory are writable.";
-
+$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable.";
 
 /* End of file imglib_lang.php */
 /* Location: ./system/language/english/imglib_lang.php */
\ No newline at end of file
diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php
index af92066..9c8909a 100644
--- a/system/language/english/migration_lang.php
+++ b/system/language/english/migration_lang.php
@@ -27,7 +27,7 @@
 
 $lang['migration_none_found']			= "No migrations were found.";
 $lang['migration_not_found']			= "No migration could be found with the version number: %d.";
-$lang['migration_multiple_version']		= "This are multiple migrations with the same version number: %d.";
+$lang['migration_multiple_version']		= "There are multiple migrations with the same version number: %d.";
 $lang['migration_class_doesnt_exist']	= "The migration class \"%s\" could not be found.";
 $lang['migration_missing_up_method']	= "The migration class \"%s\" is missing an 'up' method.";
 $lang['migration_missing_down_method']	= "The migration class \"%s\" is missing a 'down' method.";
diff --git a/system/language/english/unit_test_lang.php b/system/language/english/unit_test_lang.php
index 36e9aca..146ec25 100644
--- a/system/language/english/unit_test_lang.php
+++ b/system/language/english/unit_test_lang.php
@@ -45,6 +45,5 @@
 $lang['ut_null']			= 'Null';
 $lang['ut_notes']			= 'Notes';
 
-
 /* End of file unit_test_lang.php */
 /* Location: ./system/language/english/unit_test_lang.php */
\ No newline at end of file
diff --git a/system/language/english/upload_lang.php b/system/language/english/upload_lang.php
index c3cb9c3..de814d3 100644
--- a/system/language/english/upload_lang.php
+++ b/system/language/english/upload_lang.php
@@ -42,6 +42,5 @@
 $lang['upload_bad_filename'] = "The file name you submitted already exists on the server.";
 $lang['upload_not_writable'] = "The upload destination folder does not appear to be writable.";
 
-
 /* End of file upload_lang.php */
 /* Location: ./system/language/english/upload_lang.php */
\ No newline at end of file
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index f028924..0e9ec5e 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -48,7 +48,8 @@
    -  Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment.
    -  Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder.
    -  Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths.
-   -  Updated email validation methods to use filter_var() instead of PCRE.
+   -  Updated email validation methods to use ``filter_var()`` instead of PCRE.
+   -  Changed environment defaults to report all errors in 'development' and only fatal ones in 'testing' and 'production' but only display them in 'development'.
 
 -  Helpers
 
@@ -202,6 +203,8 @@
    -  Added support for HTTP code 303 ("See Other") in set_status_header().
    -  Changed :doc:`Config Library <libraries/config>` method site_url() to accept an array as well.
    -  Added method ``strip_image_tags()`` to the :doc:`Security Library <libraries/security>`.
+   -  Changed ``_exception_handler()`` to respect php.ini 'display_errors' setting.
+
 
 Bug fixes for 3.0
 ------------------
@@ -310,6 +313,7 @@
 -  Fixed a bug (#1545) - :doc:`Query Builder <database/query_builder>` method ``limit()`` wasn't executed properly under Oracle.
 -  Fixed a bug (#1551) - :doc:`Date Helper <helpers/date_helper>` function ``standard_date()`` didn't properly format *W3C* and *ATOM* standard dates.
 -  Fixed a bug in :doc:`Query Builder <database/query_builder>` method join() where literal values were escaped as if they were fields.
+-  Fixed a bug (#135) - PHP Error logging was impossible without the errors being displayed.
 
 Version 2.1.2
 =============