Merge pull request #3562 from avenirer/patch-1

Allow not escaping the value in set_value()
diff --git a/system/core/Common.php b/system/core/Common.php
index c3198b3..9f50974 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -86,7 +86,7 @@
 	 *
 	 * @link	https://bugs.php.net/bug.php?id=54709
 	 * @param	string
-	 * @return	void
+	 * @return	bool
 	 */
 	function is_really_writable($file)
 	{
diff --git a/system/core/Loader.php b/system/core/Loader.php
index ff78386..b2eeb3b 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -1244,7 +1244,7 @@
 
 		if ( ! isset($autoload))
 		{
-			return FALSE;
+			return;
 		}
 
 		// Autoload packages
diff --git a/system/database/DB.php b/system/database/DB.php
index d411b67..8ea7ca6 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -61,18 +61,23 @@
 		}
 
 		include($file_path);
-		// Make packages contain database config files
-		foreach (get_instance()->load->get_package_paths() as $path)
+
+		// Make packages contain database config files,
+		// given that the controller instance already exists
+		if (class_exists('CI_Controller', FALSE))
 		{
-			if ($path !== APPPATH)
+			foreach (get_instance()->load->get_package_paths() as $path)
 			{
-				if (file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php'))
+				if ($path !== APPPATH)
 				{
-					include($file_path);
-				}
-				elseif (file_exists($file_path = $path.'config/database.php'))
-				{
-					include($file_path);
+					if (file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php'))
+					{
+						include($file_path);
+					}
+					elseif (file_exists($file_path = $path.'config/database.php'))
+					{
+						include($file_path);
+					}
 				}
 			}
 		}
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index a0803f1..bbe65b4 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -822,7 +822,7 @@
 	{
 		if ( ! $this->trans_enabled)
 		{
-			return FALSE;
+			return;
 		}
 
 		// When transactions are nested we only begin/commit/rollback the outermost ones
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 774d515..57356ac 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -316,7 +316,7 @@
 	 * Database Backup
 	 *
 	 * @param	array	$params
-	 * @return	void
+	 * @return	string
 	 */
 	public function backup($params = array())
 	{
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 3791205..95c94a1 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -65,7 +65,7 @@
 	{
 		if ($filename === '' OR $data === '')
 		{
-			return FALSE;
+			return;
 		}
 		elseif ($data === NULL)
 		{
@@ -77,7 +77,7 @@
 			}
 			else
 			{
-				return FALSE;
+				return;
 			}
 		}
 		else
@@ -98,7 +98,7 @@
 				/* If we're going to detect the MIME type,
 				 * we'll need a file extension.
 				 */
-				return FALSE;
+				return;
 			}
 
 			// Load the mime types
@@ -125,7 +125,7 @@
 
 		if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE)
 		{
-			return FALSE;
+			return;
 		}
 
 		// Clean output buffer
diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php
index fad4ea7..e3e6813 100644
--- a/system/libraries/Encryption.php
+++ b/system/libraries/Encryption.php
@@ -160,7 +160,7 @@
 
 		if ( ! $this->_drivers['mcrypt'] && ! $this->_drivers['openssl'])
 		{
-			return show_error('Encryption: Unable to find an available encryption driver.');
+			show_error('Encryption: Unable to find an available encryption driver.');
 		}
 
 		isset(self::$func_override) OR self::$func_override = (extension_loaded('mbstring') && ini_get('mbstring.func_override'));
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index 8ce4243..ae36a3b 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -421,11 +421,11 @@
 	 * Stores the current schema version
 	 *
 	 * @param	string	$migration	Migration reached
-	 * @return	void	Outputs a report of the migration
+	 * @return	void
 	 */
 	protected function _update_version($migration)
 	{
-		return $this->db->update($this->_migration_table, array(
+		$this->db->update($this->_migration_table, array(
 			'version' => $migration
 		));
 	}
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index 2551e54..ba1919b 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -143,8 +143,7 @@
 		session_start();
 
 		// Is session ID auto-regeneration configured? (ignoring ajax requests)
-		if ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH'])
-			&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'
+		if ((empty($_SERVER['HTTP_X_REQUESTED_WITH']) OR strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest')
 			&& ($regenerate_time = config_item('sess_time_to_update')) > 0
 		)
 		{
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index 0ec6e34..20cec00 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -252,7 +252,7 @@
 	 *
 	 * Releases locks
 	 *
-	 * @return	void
+	 * @return	bool
 	 */
 	public function close()
 	{
diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php
index ad8315d..d3ef34a 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -269,7 +269,7 @@
 	 *
 	 * Releases locks and closes file descriptor.
 	 *
-	 * @return	void
+	 * @return	bool
 	 */
 	public function close()
 	{
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index 00112c8..600b8ca 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -229,7 +229,7 @@
 	 *
 	 * Releases locks and closes connection.
 	 *
-	 * @return	void
+	 * @return	bool
 	 */
 	public function close()
 	{
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index c53975a..c3c75b3 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -230,7 +230,7 @@
 	 *
 	 * Releases locks and closes connection.
 	 *
-	 * @return	void
+	 * @return	bool
 	 */
 	public function close()
 	{
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 7a39dfc..2d98230 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -502,7 +502,7 @@
 	/**
 	 * Default Template
 	 *
-	 * @return	void
+	 * @return	array
 	 */
 	protected function _default_template()
 	{
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 9d7cbff..8fbc18f 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -1792,6 +1792,7 @@
 	 *
 	 * @param	string
 	 * @param	mixed
+	 * @return	string
 	 */
 	public function serializedata($typ, $val)
 	{
diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst
index 2da1f98..bafa08e 100644
--- a/user_guide_src/source/database/utilities.rst
+++ b/user_guide_src/source/database/utilities.rst
@@ -252,8 +252,8 @@
 	.. php:method:: backup([$params = array()])
 
 		:param	array	$params: An associative array of options
-		:returns:	void
-		:rtype:	void
+		:returns:	raw/(g)zipped SQL query string
+		:rtype:	string
 
 		Perform a database backup, per user preferences.