summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorDaniel Hunsaker <danhunsaker@gmail.com>2013-03-04 10:04:25 +0100
committerDaniel Hunsaker <danhunsaker@gmail.com>2013-03-04 10:04:25 +0100
commite5d7af508680afced4c96b5a52a054c73b6c537e (patch)
tree133b6f7791b975bfc6ecb017ba3a8d862cdecb6c /system
parent3b5b7f48848d098c6190781f8790a1b0dcb0217c (diff)
parent5780d8b2078126f8eb5738658fceadd38c66fe5b (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into feature/exit-status
Diffstat (limited to 'system')
-rw-r--r--system/core/Loader.php2
-rw-r--r--system/database/DB_result.php9
-rw-r--r--system/database/DB_utility.php4
-rw-r--r--system/helpers/text_helper.php13
-rw-r--r--system/libraries/Session/drivers/Session_cookie.php2
5 files changed, 15 insertions, 15 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 6e5b58ba7..d4e63231c 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -459,7 +459,7 @@ class CI_Loader {
*/
public function vars($vars = array(), $val = '')
{
- if ($val !== '' && is_string($vars))
+ if (is_string($vars))
{
$vars = array($vars => $val);
}
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index a044fd5dc..41a851777 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -478,12 +478,9 @@ class CI_DB_result {
return NULL;
}
- if (isset($result[$this->current_row + 1]))
- {
- ++$this->current_row;
- }
-
- return $result[$this->current_row];
+ return isset($result[$this->current_row + 1])
+ ? $result[++$this->current_row]
+ : NULL;
}
// --------------------------------------------------------------------
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 9822fdaa3..9f953d4ac 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -238,7 +238,7 @@ abstract class CI_DB_utility {
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
}
- $out = rtrim($out).$newline;
+ $out = substr(rtrim($out), 0, -strlen($delim)).$newline;
// Next blast through the result array and build out the rows
while ($row = $query->unbuffered_row('array'))
@@ -247,7 +247,7 @@ abstract class CI_DB_utility {
{
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
}
- $out = rtrim($out).$newline;
+ $out = substr(rtrim($out), 0, -strlen($delim)).$newline;
}
return $out;
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 54db14f94..b2351db95 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -363,9 +363,9 @@ if ( ! function_exists('convert_accented_characters'))
*/
function convert_accented_characters($str)
{
- static $_foreign_characters;
+ static $array_from, $array_to;
- if ( ! is_array($_foreign_characters))
+ if ( ! is_array($array_from))
{
if (file_exists(APPPATH.'config/foreign_chars.php'))
{
@@ -379,14 +379,17 @@ if ( ! function_exists('convert_accented_characters'))
if (empty($foreign_characters) OR ! is_array($foreign_characters))
{
- $_foreign_characters = array();
+ $array_from = array();
+ $array_to = array();
+
return $str;
}
- $_foreign_characters = $foreign_characters;
+ $array_from = array_keys($foreign_characters);
+ $array_to = array_values($foreign_characters);
}
- return preg_replace(array_keys($_foreign_characters), array_values($_foreign_characters), $str);
+ return preg_replace($array_from, $array_to, $str);
}
}
diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php
index 057e5a1d1..0e8644102 100644
--- a/system/libraries/Session/drivers/Session_cookie.php
+++ b/system/libraries/Session/drivers/Session_cookie.php
@@ -494,7 +494,7 @@ class CI_Session_cookie extends CI_Session_driver {
$this->userdata = array(
'session_id' => $this->_make_sess_id(),
'ip_address' => $this->CI->input->ip_address(),
- 'user_agent' => substr($this->CI->input->user_agent(), 0, 120),
+ 'user_agent' => trim(substr($this->CI->input->user_agent(), 0, 120)),
'last_activity' => $this->now,
);