mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[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
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user