diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2011-11-30 21:36:56 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2011-11-30 21:36:56 +0100 |
commit | c1311faebf01db1cd0f27420af31c326b0270d37 (patch) | |
tree | 0335426a5940be0a67388158a34bb23add302166 | |
parent | 65e6ab55302e5d0c30fa86e06a460fed8167b84a (diff) | |
download | forums-c1311faebf01db1cd0f27420af31c326b0270d37.tar forums-c1311faebf01db1cd0f27420af31c326b0270d37.tar.gz forums-c1311faebf01db1cd0f27420af31c326b0270d37.tar.bz2 forums-c1311faebf01db1cd0f27420af31c326b0270d37.tar.xz forums-c1311faebf01db1cd0f27420af31c326b0270d37.zip |
[ticket/10345] Check directly whether the key to use exists
PHPBB3-10345
-rw-r--r-- | phpBB/includes/session.php | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 401cb0d371..fcbe8aed2c 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1886,17 +1886,25 @@ class user extends session else { $use_plural_form = $this->get_plural_form($args[$i]); - $numbers = array_keys($lang); - - foreach ($numbers as $num) + if (isset($lang[$use_plural_form])) { - if ($num > $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 the key we need to use does not exist, we fall back to the previous one. - break; - } + if ($num > $use_plural_form) + { + break; + } - $key_found = $num; + $key_found = $num; + } } break; } |