diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index 44fba06d9d..e38950f4c1 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -643,9 +643,23 @@ class log implements \phpbb\log\log_interface
$operations = array();
foreach ($this->user->lang as $key => $value)
{
- if (substr($key, 0, 4) == 'LOG_' && preg_match($keywords_pattern, $value))
+ if (substr($key, 0, 4) == 'LOG_')
{
- $operations[] = $key;
+ if (is_array($value))
+ {
+ foreach ($value as $plural_value)
+ {
+ if (preg_match($keywords_pattern, $plural_value))
+ {
+ $operations[] = $key;
+ break;
+ }
+ }
+ }
+ else if (preg_match($keywords_pattern, $value))
+ {
+ $operations[] = $key;
+ }
}
}
diff --git a/tests/log/fixtures/full_log.xml b/tests/log/fixtures/full_log.xml
index a10c224e0e..4e5538d5a9 100644
--- a/tests/log/fixtures/full_log.xml
+++ b/tests/log/fixtures/full_log.xml
@@ -119,6 +119,18 @@
LOG_USER
a:1:{i:0;s:5:"guest";}
+
+ 10
+ 3
+ 1
+ 0
+ 0
+ 0
+ 127.0.0.1
+ 1
+ LOG_SINGULAR_PLURAL
+ a:1:{i:0;i:2;}
+
user_id
diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php
index 2ddf7522f4..2f64459062 100644
--- a/tests/log/function_view_log_test.php
+++ b/tests/log/function_view_log_test.php
@@ -206,6 +206,25 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'viewforum' => '',
'action' => 'LOG_USER guest',
),
+ 10 => array(
+ 'id' => 10,
+
+ 'reportee_id' => 0,
+ 'reportee_username' => '',
+ 'reportee_username_full'=> '',
+
+ 'user_id' => 1,
+ 'username' => 'Anonymous',
+ 'username_full' => 'Anonymous',
+
+ 'ip' => '127.0.0.1',
+ 'time' => 1,
+ 'forum_id' => 0,
+ 'topic_id' => 0,
+
+ 'viewforum' => '',
+ 'action' => 'LOG_SINGULAR_PLURAL 2',
+ ),
);
$test_cases = array(
@@ -277,10 +296,20 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'user', 0, 5, 0, 0, 0, 2,
),
array(
- 'expected' => array(8, 9),
+ 'expected' => array(8, 9, 10),
'expected_returned' => 0,
'users', 0,
),
+ array(
+ 'expected' => array(1),
+ 'expected_returned' => 0,
+ 'admin', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'install',
+ ),
+ array(
+ 'expected' => array(10),
+ 'expected_returned' => 0,
+ 'user', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'plural',
+ ),
);
foreach ($test_cases as $case => $case_data)
@@ -333,6 +362,10 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'LOG_INSTALL_INSTALLED' => 'installed: %s',
'LOG_USER' => 'User
%s',
'LOG_MOD2' => 'Mod2',
+ 'LOG_SINGULAR_PLURAL' => array(
+ 1 => 'singular',
+ 2 => 'plural (%d)',
+ ),
);
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);