mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 00:07:44 +02:00
[ticket/10345] Check directly whether the key to use exists
PHPBB3-10345
This commit is contained in:
@@ -1886,18 +1886,26 @@ class user extends session
|
||||
else
|
||||
{
|
||||
$use_plural_form = $this->get_plural_form($args[$i]);
|
||||
if (isset($lang[$use_plural_form]))
|
||||
{
|
||||
// The key we should use exists, so we use it.
|
||||
$key_found = $use_plural_form;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the key we need to use does not exist, we fall back to the previous one.
|
||||
$numbers = array_keys($lang);
|
||||
|
||||
foreach ($numbers as $num)
|
||||
{
|
||||
if ($num > $use_plural_form)
|
||||
{
|
||||
// If the key we need to use does not exist, we fall back to the previous one.
|
||||
break;
|
||||
}
|
||||
|
||||
$key_found = $num;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user