diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index e38950f4c1..24b622dbac 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -520,7 +520,7 @@ class log implements \phpbb\log\log_interface
$num_args = 0;
if (!is_array($this->user->lang[$row['log_operation']]))
{
- $num_args = substr_count($log[$i]['action'], '%');
+ $num_args = substr_count($this->user->lang[$row['log_operation']], '%');
}
else
{
diff --git a/tests/log/fixtures/full_log.xml b/tests/log/fixtures/full_log.xml
index 4e5538d5a9..ef35884444 100644
--- a/tests/log/fixtures/full_log.xml
+++ b/tests/log/fixtures/full_log.xml
@@ -131,6 +131,18 @@
LOG_SINGULAR_PLURAL
a:1:{i:0;i:2;}
+
+ 11
+ 1
+ 1
+ 15
+ 3
+ 0
+ 127.0.0.1
+ 1
+ LOG_MOD3
+ a:1:{i:0;s:5:"guest";}
+
user_id
diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php
index 2f64459062..542d0adf9d 100644
--- a/tests/log/function_view_log_test.php
+++ b/tests/log/function_view_log_test.php
@@ -225,6 +225,27 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'viewforum' => '',
'action' => 'LOG_SINGULAR_PLURAL 2',
),
+ 11 => array(
+ 'id' => 11,
+
+ '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' => 15,
+ 'topic_id' => 3,
+
+ 'viewforum' => '',
+ 'action' => 'LOG_MOD3 guest ',
+ 'viewtopic' => '',
+ 'viewlogs' => '',
+ ),
);
$test_cases = array(
@@ -310,6 +331,11 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'expected_returned' => 0,
'user', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'plural',
),
+ array(
+ 'expected' => array(11),
+ 'expected_returned' => 0,
+ 'mod', 0, 5, 0, 15, 3,
+ ),
);
foreach ($test_cases as $case => $case_data)
@@ -362,6 +388,7 @@ 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_MOD3' => 'Mod3: %1$s, %2$s',
'LOG_SINGULAR_PLURAL' => array(
1 => 'singular',
2 => 'plural (%d)',