[ticket/10345] Check directly whether the key to use exists

PHPBB3-10345
This commit is contained in:
Joas Schilling 2011-11-30 21:36:56 +01:00
parent 65e6ab5530
commit c1311faebf

View file

@ -1886,17 +1886,25 @@ class user extends session
else else
{ {
$use_plural_form = $this->get_plural_form($args[$i]); $use_plural_form = $this->get_plural_form($args[$i]);
$numbers = array_keys($lang); if (isset($lang[$use_plural_form]))
foreach ($numbers as $num)
{ {
if ($num > $use_plural_form) // The key we should use exists, so we use it.
{ $key_found = $use_plural_form;
// If the key we need to use does not exist, we fall back to the previous one. }
break; else
} {
// If the key we need to use does not exist, we fall back to the previous one.
$numbers = array_keys($lang);
$key_found = $num; foreach ($numbers as $num)
{
if ($num > $use_plural_form)
{
break;
}
$key_found = $num;
}
} }
break; break;
} }