aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/utf/utf_tools.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/utf/utf_tools.php')
-rw-r--r--phpBB/includes/utf/utf_tools.php51
1 files changed, 14 insertions, 37 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 31ad5027fd..6f3ac93305 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -105,10 +105,6 @@ if (!extension_loaded('xml'))
if (extension_loaded('mbstring'))
{
mb_internal_encoding('UTF-8');
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // ini_set is only used to try to make things better for mods using mbstring directly
- // I know they're not supposed to, but you know they still could and the fix is costless
- @ini_set("mbstring.internal_encoding", 'UTF-8');
/**
* UTF-8 aware alternative to strrpos
@@ -133,15 +129,11 @@ if (extension_loaded('mbstring'))
if (is_null($offset))
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_strrpos($str, $needle, 0, 'UTF-8');
+ return mb_strrpos($str, $needle);
}
else
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_strrpos($str, $needle, $offset, 'UTF-8');
+ return mb_strrpos($str, $needle, $offset);
}
}
}
@@ -161,9 +153,8 @@ if (extension_loaded('mbstring'))
{
return false;
}
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_strrpos($str, $needle, 'UTF-8');
+
+ return mb_strrpos($str, $needle);
}
else
{
@@ -172,12 +163,10 @@ if (extension_loaded('mbstring'))
trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_ERROR);
return false;
}
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- $str = mb_substr($str, $offset, mb_strlen($str, 'UTF-8'), 'UTF-8');
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- if (false !== ($pos = mb_strrpos($str, $needle, 'UTF-8')))
+
+ $str = mb_substr($str, $offset);
+
+ if (false !== ($pos = mb_strrpos($str, $needle)))
{
return $pos + $offset;
}
@@ -195,15 +184,11 @@ if (extension_loaded('mbstring'))
{
if (is_null($offset))
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_strpos($str, $needle, 0, 'UTF-8');
+ return mb_strpos($str, $needle);
}
else
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_strpos($str, $needle, $offset, 'UTF-8');
+ return mb_strpos($str, $needle, $offset);
}
}
@@ -213,9 +198,7 @@ if (extension_loaded('mbstring'))
*/
function utf8_strtolower($str)
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_strtolower($str, 'UTF-8');
+ return mb_strtolower($str);
}
/**
@@ -224,9 +207,7 @@ if (extension_loaded('mbstring'))
*/
function utf8_strtoupper($str)
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_strtoupper($str, 'UTF-8');
+ return mb_strtoupper($str);
}
/**
@@ -237,15 +218,11 @@ if (extension_loaded('mbstring'))
{
if (is_null($length))
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_substr($str, $offset, mb_strlen($str, 'UTF-8'), 'UTF-8');
+ return mb_substr($str, $offset);
}
else
{
- // Fix for http://www.phpbb.com/bugs/phpbb3/52315
- // Explicit encoding
- return mb_substr($str, $offset, $length, 'UTF-8');
+ return mb_substr($str, $offset, $length);
}
}