mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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:
parent
e8cc26e79c
commit
66c116f7de
1 changed files with 14 additions and 2 deletions
|
@ -1778,9 +1778,13 @@ else
|
||||||
|
|
||||||
if (!is_array($strings))
|
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)
|
foreach ($strings as $key => $string)
|
||||||
{
|
{
|
||||||
|
@ -1788,11 +1792,19 @@ else
|
||||||
{
|
{
|
||||||
foreach ($string as $_key => $_string)
|
foreach ($string as $_key => $_string)
|
||||||
{
|
{
|
||||||
|
if (Normalizer::isNormalized($strings[$key][$_key]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$strings[$key][$_key] = Normalizer::normalize($strings[$key][$_key]);
|
$strings[$key][$_key] = Normalizer::normalize($strings[$key][$_key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (Normalizer::isNormalized($strings[$key]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$strings[$key] = Normalizer::normalize($strings[$key]);
|
$strings[$key] = Normalizer::normalize($strings[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue