From 1fb500077784638399be79b32fe354aec257413c Mon Sep 17 00:00:00 2001 From: Gabriel Potkány Date: Wed, 4 Feb 2015 01:45:59 +0100 Subject: Fixed inconsistent return types --- system/core/Common.php | 2 +- system/database/DB_driver.php | 2 +- system/database/DB_utility.php | 2 +- system/helpers/download_helper.php | 2 +- system/libraries/Encryption.php | 2 +- system/libraries/Migration.php | 2 +- system/libraries/Session/drivers/Session_database_driver.php | 2 +- system/libraries/Session/drivers/Session_files_driver.php | 2 +- system/libraries/Session/drivers/Session_memcached_driver.php | 2 +- system/libraries/Session/drivers/Session_redis_driver.php | 2 +- system/libraries/Table.php | 2 +- user_guide_src/source/database/utilities.rst | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index c3198b31f..9f509745f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -86,7 +86,7 @@ if ( ! function_exists('is_really_writable')) * * @link https://bugs.php.net/bug.php?id=54709 * @param string - * @return void + * @return bool */ function is_really_writable($file) { diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index a0803f170..bbe65b410 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -822,7 +822,7 @@ abstract class CI_DB_driver { { 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 774d51533..ecfda522c 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -316,7 +316,7 @@ abstract class CI_DB_utility { * Database Backup * * @param array $params - * @return void + * @return mixed */ public function backup($params = array()) { diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 379120552..2710a4ac7 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -59,7 +59,7 @@ if ( ! function_exists('force_download')) * @param string filename * @param mixed the data to be downloaded * @param bool whether to try and send the actual file MIME type - * @return void + * @return bool */ function force_download($filename = '', $data = '', $set_mime = FALSE) { diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php index 171a28b34..e4c668b6d 100644 --- a/system/libraries/Encryption.php +++ b/system/libraries/Encryption.php @@ -160,7 +160,7 @@ class CI_Encryption { 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 8ce4243fe..f61814988 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -421,7 +421,7 @@ class CI_Migration { * Stores the current schema version * * @param string $migration Migration reached - * @return void Outputs a report of the migration + * @return object Outputs a report of the migration */ protected function _update_version($migration) { diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php index 0ec6e34f0..20cec00fd 100644 --- a/system/libraries/Session/drivers/Session_database_driver.php +++ b/system/libraries/Session/drivers/Session_database_driver.php @@ -252,7 +252,7 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan * * 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 ad8315d52..d3ef34acd 100644 --- a/system/libraries/Session/drivers/Session_files_driver.php +++ b/system/libraries/Session/drivers/Session_files_driver.php @@ -269,7 +269,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * * 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 00112c88c..600b8ca66 100644 --- a/system/libraries/Session/drivers/Session_memcached_driver.php +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -229,7 +229,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa * * 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 c53975ae4..c3c75b3b6 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -230,7 +230,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle * * 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 7a39dfc77..2d9823093 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -502,7 +502,7 @@ class CI_Table { /** * Default Template * - * @return void + * @return array */ protected function _default_template() { diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst index 2da1f981d..7886be434 100644 --- a/user_guide_src/source/database/utilities.rst +++ b/user_guide_src/source/database/utilities.rst @@ -252,7 +252,7 @@ Class Reference .. php:method:: backup([$params = array()]) :param array $params: An associative array of options - :returns: void + :returns: mixed :rtype: void Perform a database backup, per user preferences. -- cgit v1.2.3-24-g4f1b From cea5fb713822d00460222deaa1cf66543effccf8 Mon Sep 17 00:00:00 2001 From: Gabriel Potkány Date: Wed, 4 Feb 2015 08:22:06 +0100 Subject: Adjusted returns/return types to suggestions --- system/database/DB_utility.php | 4 ++-- system/helpers/download_helper.php | 10 +++++----- system/libraries/Migration.php | 4 ++-- user_guide_src/source/database/utilities.rst | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index ecfda522c..9eac2ec41 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -316,7 +316,7 @@ abstract class CI_DB_utility { * Database Backup * * @param array $params - * @return mixed + * @return string */ public function backup($params = array()) { @@ -417,7 +417,7 @@ abstract class CI_DB_utility { return gzencode($this->_backup($prefs)); } - return; + return ''; } } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 2710a4ac7..95c94a1b8 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -59,13 +59,13 @@ if ( ! function_exists('force_download')) * @param string filename * @param mixed the data to be downloaded * @param bool whether to try and send the actual file MIME type - * @return bool + * @return void */ function force_download($filename = '', $data = '', $set_mime = FALSE) { if ($filename === '' OR $data === '') { - return FALSE; + return; } elseif ($data === NULL) { @@ -77,7 +77,7 @@ if ( ! function_exists('force_download')) } else { - return FALSE; + return; } } else @@ -98,7 +98,7 @@ if ( ! function_exists('force_download')) /* 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 ( ! function_exists('force_download')) if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) { - return FALSE; + return; } // Clean output buffer diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index f61814988..ae36a3b45 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -421,11 +421,11 @@ class CI_Migration { * Stores the current schema version * * @param string $migration Migration reached - * @return object 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/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst index 7886be434..2aeadfdda 100644 --- a/user_guide_src/source/database/utilities.rst +++ b/user_guide_src/source/database/utilities.rst @@ -252,8 +252,8 @@ Class Reference .. php:method:: backup([$params = array()]) :param array $params: An associative array of options - :returns: mixed - :rtype: void + :returns: string + :rtype: string Perform a database backup, per user preferences. -- cgit v1.2.3-24-g4f1b From d9287a076a378209fbb78db80ee915c9cbedf9e0 Mon Sep 17 00:00:00 2001 From: Gabriel Potkány Date: Wed, 4 Feb 2015 08:47:56 +0100 Subject: Removed one more return value (CI_Loader::_ci_autoloader) --- system/core/Loader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Loader.php b/system/core/Loader.php index ff7838640..b2eeb3b1d 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1244,7 +1244,7 @@ class CI_Loader { if ( ! isset($autoload)) { - return FALSE; + return; } // Autoload packages -- cgit v1.2.3-24-g4f1b From e8a2792de5ff21d0b89304da0b94e5ea24b94fa7 Mon Sep 17 00:00:00 2001 From: Gabriel Potkány Date: Wed, 4 Feb 2015 09:52:50 +0100 Subject: Add missing return type --- system/libraries/Xmlrpc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 9d7cbffa2..8fbc18f04 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1792,6 +1792,7 @@ class XML_RPC_Values extends CI_Xmlrpc * * @param string * @param mixed + * @return string */ public function serializedata($typ, $val) { -- cgit v1.2.3-24-g4f1b From 5fa4b7266d7c61dc2482e529bd6afb9a67edadb7 Mon Sep 17 00:00:00 2001 From: Gabriel Potkány Date: Wed, 4 Feb 2015 10:46:24 +0100 Subject: Fixed return values types in session drivers --- system/libraries/Session/drivers/Session_files_driver.php | 6 +++--- system/libraries/Session/drivers/Session_memcached_driver.php | 2 +- system/libraries/Session/drivers/Session_redis_driver.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php index d3ef34acd..217d3f9db 100644 --- a/system/libraries/Session/drivers/Session_files_driver.php +++ b/system/libraries/Session/drivers/Session_files_driver.php @@ -156,13 +156,13 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle if (($this->_file_handle = fopen($this->_file_path.$session_id, 'w+b')) === FALSE) { log_message('error', "Session: File '".$this->_file_path.$session_id."' doesn't exist and cannot be created."); - return FALSE; + return ''; } } elseif (($this->_file_handle = fopen($this->_file_path.$session_id, 'r+b')) === FALSE) { log_message('error', "Session: Unable to open file '".$this->_file_path.$session_id."'."); - return FALSE; + return ''; } if (flock($this->_file_handle, LOCK_EX) === FALSE) @@ -170,7 +170,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle log_message('error', "Session: Unable to obtain lock for file '".$this->_file_path.$session_id."'."); fclose($this->_file_handle); $this->_file_handle = NULL; - return FALSE; + return ''; } // Needed by write() to detect session_regenerate_id() calls diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php index 600b8ca66..80d8b3df6 100644 --- a/system/libraries/Session/drivers/Session_memcached_driver.php +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -170,7 +170,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa return $session_data; } - return FALSE; + return '';; } // ------------------------------------------------------------------------ diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index c3c75b3b6..af427d273 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -171,7 +171,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle return $session_data; } - return FALSE; + return ''; } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 0dd2538900bcbf5ab34798c9fb56632fefbfdad0 Mon Sep 17 00:00:00 2001 From: Gabriel Potkány Date: Wed, 4 Feb 2015 12:15:06 +0100 Subject: Revert "Fixed return values types in session drivers" This reverts commit 5fa4b7266d7c61dc2482e529bd6afb9a67edadb7. --- system/libraries/Session/drivers/Session_files_driver.php | 6 +++--- system/libraries/Session/drivers/Session_memcached_driver.php | 2 +- system/libraries/Session/drivers/Session_redis_driver.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php index 217d3f9db..d3ef34acd 100644 --- a/system/libraries/Session/drivers/Session_files_driver.php +++ b/system/libraries/Session/drivers/Session_files_driver.php @@ -156,13 +156,13 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle if (($this->_file_handle = fopen($this->_file_path.$session_id, 'w+b')) === FALSE) { log_message('error', "Session: File '".$this->_file_path.$session_id."' doesn't exist and cannot be created."); - return ''; + return FALSE; } } elseif (($this->_file_handle = fopen($this->_file_path.$session_id, 'r+b')) === FALSE) { log_message('error', "Session: Unable to open file '".$this->_file_path.$session_id."'."); - return ''; + return FALSE; } if (flock($this->_file_handle, LOCK_EX) === FALSE) @@ -170,7 +170,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle log_message('error', "Session: Unable to obtain lock for file '".$this->_file_path.$session_id."'."); fclose($this->_file_handle); $this->_file_handle = NULL; - return ''; + return FALSE; } // Needed by write() to detect session_regenerate_id() calls diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php index 80d8b3df6..600b8ca66 100644 --- a/system/libraries/Session/drivers/Session_memcached_driver.php +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -170,7 +170,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa return $session_data; } - return '';; + return FALSE; } // ------------------------------------------------------------------------ diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index af427d273..c3c75b3b6 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -171,7 +171,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle return $session_data; } - return ''; + return FALSE; } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 40bbd60bcc5135f898f46e502f7b04ef065274e0 Mon Sep 17 00:00:00 2001 From: Gabriel Potkány Date: Wed, 4 Feb 2015 14:06:47 +0100 Subject: Adjusted return type for CI_DB_utility::backup to suggestions --- system/database/DB_utility.php | 2 +- user_guide_src/source/database/utilities.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index 9eac2ec41..57356ac53 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -417,7 +417,7 @@ abstract class CI_DB_utility { return gzencode($this->_backup($prefs)); } - return ''; + return; } } diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst index 2aeadfdda..bafa08ed5 100644 --- a/user_guide_src/source/database/utilities.rst +++ b/user_guide_src/source/database/utilities.rst @@ -252,7 +252,7 @@ Class Reference .. php:method:: backup([$params = array()]) :param array $params: An associative array of options - :returns: string + :returns: raw/(g)zipped SQL query string :rtype: string Perform a database backup, per user preferences. -- cgit v1.2.3-24-g4f1b