summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/database/DB_utility.php4
-rw-r--r--system/helpers/text_helper.php13
2 files changed, 10 insertions, 7 deletions
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);
}
}