aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2010-04-26 20:46:09 +0200
committerIgor Wiedler <igor@wiedler.ch>2011-03-05 11:52:22 +0100
commit66c116f7deb7adcd8928026aeceb536c72f5e86c (patch)
tree7a39dcd205b980cb230f6084e5eb74820f85602c /phpBB
parente8cc26e79c701590af14612f6da6757d51a05965 (diff)
downloadforums-66c116f7deb7adcd8928026aeceb536c72f5e86c.tar
forums-66c116f7deb7adcd8928026aeceb536c72f5e86c.tar.gz
forums-66c116f7deb7adcd8928026aeceb536c72f5e86c.tar.bz2
forums-66c116f7deb7adcd8928026aeceb536c72f5e86c.tar.xz
forums-66c116f7deb7adcd8928026aeceb536c72f5e86c.zip
[ticket/9669] Add isNormalized checks for performance
Since isNormalized is less expensive than normalize[1] and normalization will be applied repeatedly in most cases[2], it's more efficient to check for isNormalized. [1] http://area51.phpbb.com/phpBB/viewtopic.php?f=81&t=32718&p=208005#p208005 [2] phpBB 3.0 has a call to utf8_normalize_nfc wrapped around any multibyte request_var call. PHPBB3-9669
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/utf/utf_tools.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 8fa91a4c5b..4cc0486e91 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -1778,9 +1778,13 @@ else
if (!is_array($strings))
{
- $strings = Normalizer::normalize($strings);
+ if (Normalizer::isNormalized($strings))
+ {
+ return $strings;
+ }
+ return Normalizer::normalize($strings);
}
- if (is_array($strings))
+ else
{
foreach ($strings as $key => $string)
{
@@ -1788,11 +1792,19 @@ else
{
foreach ($string as $_key => $_string)
{
+ if (Normalizer::isNormalized($strings[$key][$_key]))
+ {
+ continue;
+ }
$strings[$key][$_key] = Normalizer::normalize($strings[$key][$_key]);
}
}
else
{
+ if (Normalizer::isNormalized($strings[$key]))
+ {
+ continue;
+ }
$strings[$key] = Normalizer::normalize($strings[$key]);
}
}