summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAhmad Anbar <aanbar@gmail.com>2015-02-08 17:29:52 +0100
committerAhmad Anbar <aanbar@gmail.com>2015-02-08 17:29:52 +0100
commited520408514fff6486788e1543589418d24d885e (patch)
tree07fd3194e9c6baf7aeaa9ccdd164e3fec4494922 /system
parente5454f9b28f123a5549971f580255a065b2f8cc2 (diff)
parent266c93cc505ae9a8cafb41f9d9432b056de492e0 (diff)
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system')
-rw-r--r--system/core/Common.php2
-rw-r--r--system/core/Input.php2
-rw-r--r--system/core/Loader.php2
-rw-r--r--system/database/DB.php23
-rw-r--r--system/database/DB_driver.php2
-rw-r--r--system/database/DB_utility.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php2
-rw-r--r--system/helpers/download_helper.php8
-rw-r--r--system/helpers/form_helper.php6
-rw-r--r--system/libraries/Email.php13
-rw-r--r--system/libraries/Encryption.php2
-rw-r--r--system/libraries/Migration.php4
-rw-r--r--system/libraries/Session/Session.php5
-rw-r--r--system/libraries/Session/drivers/Session_database_driver.php2
-rw-r--r--system/libraries/Session/drivers/Session_files_driver.php12
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php2
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php2
-rw-r--r--system/libraries/Table.php2
-rw-r--r--system/libraries/Xmlrpc.php1
20 files changed, 60 insertions, 36 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/core/Input.php b/system/core/Input.php
index 72425c1c1..fae3b6c08 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -702,7 +702,7 @@ class CI_Input {
* only named with alpha-numeric text and a few other items.
*
* @param string $str Input string
- * @param string $fatal Whether to terminate script exection
+ * @param bool $fatal Whether to terminate script exection
* or to return FALSE if an invalid
* key is encountered
* @return string|bool
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
diff --git a/system/database/DB.php b/system/database/DB.php
index d411b679e..8ea7ca6fa 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -61,18 +61,23 @@ function &DB($params = '', $query_builder_override = NULL)
}
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'))
- {
- include($file_path);
- }
- elseif (file_exists($file_path = $path.'config/database.php'))
+ if ($path !== APPPATH)
{
- 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 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..57356ac53 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 string
*/
public function backup($params = array())
{
diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php
index c8d7c770d..844ffab8f 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php
@@ -154,7 +154,7 @@ class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver {
*/
protected function _list_tables($prefix_limit = FALSE)
{
- return 'SELECT '.$this->escape_identifiers('name')
+ $sql = 'SELECT '.$this->escape_identifiers('name')
.' FROM '.$this->escape_identifiers('sysobjects')
.' WHERE '.$this->escape_identifiers('type')." = 'U'";
diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php
index b5bdbf91a..f8ae5f6db 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php
@@ -183,7 +183,7 @@ class CI_DB_pdo_sqlsrv_driver extends CI_DB_pdo_driver {
*/
protected function _list_tables($prefix_limit = FALSE)
{
- return 'SELECT '.$this->escape_identifiers('name')
+ $sql = 'SELECT '.$this->escape_identifiers('name')
.' FROM '.$this->escape_identifiers('sysobjects')
.' WHERE '.$this->escape_identifiers('type')." = 'U'";
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 379120552..95c94a1b8 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -65,7 +65,7 @@ if ( ! function_exists('force_download'))
{
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/helpers/form_helper.php b/system/helpers/form_helper.php
index fb235291e..53ee8eb11 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -676,9 +676,10 @@ if ( ! function_exists('set_value'))
*
* @param string $field Field name
* @param string $default Default value
+ * @param bool $html_escape Whether to escape HTML special characters or not
* @return string
*/
- function set_value($field, $default = '')
+ function set_value($field, $default = '', $html_escape = TRUE)
{
$CI =& get_instance();
@@ -686,7 +687,8 @@ if ( ! function_exists('set_value'))
? $CI->form_validation->set_value($field, $default)
: $CI->input->post($field, FALSE);
- return html_escape($value === NULL ? $default : $value);
+ isset($value) OR $value = $default;
+ return ($html_escape) ? html_escape($value) : $value;
}
}
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 4e0e0cd9f..45c5c09b9 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -2172,11 +2172,22 @@ class CI_Email {
/**
* Get Hostname
*
+ * There are only two legal types of hostname - either a fully
+ * qualified domain name (eg: "mail.example.com") or an IP literal
+ * (eg: "[1.2.3.4]").
+ *
+ * @link https://tools.ietf.org/html/rfc5321#section-2.3.5
+ * @link http://cbl.abuseat.org/namingproblems.html
* @return string
*/
protected function _get_hostname()
{
- return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain';
+ if (isset($_SERVER['SERVER_NAME']))
+ {
+ return $_SERVER['SERVER_NAME'];
+ }
+
+ return isset($_SERVER['SERVER_ADDR']) ? '['.$_SERVER['SERVER_ADDR'].']' : '[127.0.0.1]';
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php
index fad4ea7f8..e3e68139a 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..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 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 2551e54e9..de9b1e829 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -143,8 +143,7 @@ class CI_Session {
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
)
{
@@ -154,7 +153,7 @@ class CI_Session {
}
elseif ($_SESSION['__ci_last_regenerate'] < (time() - $regenerate_time))
{
- $this->sess_regenerate(FALSE);
+ $this->sess_regenerate((bool) config_item('sess_regenerate_destroy'));
}
}
// Another work-around ... PHP doesn't seem to send the session cookie
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..5852277e8 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -107,7 +107,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
* Sanitizes the save_path directory.
*
* @param string $save_path Path to session files' directory
- * @param string $name Session cookie name, unused
+ * @param string $name Session cookie name
* @return bool
*/
public function open($save_path, $name)
@@ -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()
{
@@ -332,10 +332,16 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
$ts = time() - $maxlifetime;
+ $pattern = sprintf(
+ '/^%s[0-9a-f]{%d}$/',
+ preg_quote($this->_config['cookie_name'], '/'),
+ ($this->_config['match_ip'] === TRUE ? 72 : 40)
+ );
+
foreach ($files as $file)
{
// If the filename doesn't match this pattern, it's either not a session file or is not ours
- if ( ! preg_match('/(?:[0-9a-f]{32})?[0-9a-f]{40}$/i', $file)
+ if ( ! preg_match($pattern, $file)
OR ! is_file($this->_config['save_path'].DIRECTORY_SEPARATOR.$file)
OR ($mtime = filemtime($this->_config['save_path'].DIRECTORY_SEPARATOR.$file)) === FALSE
OR $mtime > $ts)
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/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)
{