mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/14403] Don't expect user_id and user_ip in phpbb\log
PHPBB3-14403
This commit is contained in:
parent
d64680983a
commit
0cc41b94b1
2 changed files with 11 additions and 2 deletions
|
@ -229,8 +229,8 @@ class log implements \phpbb\log\log_interface
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_ary = array(
|
$sql_ary = array(
|
||||||
'user_id' => $user_id,
|
'user_id' => !empty($user_id) ? $user_id : ANONYMOUS,
|
||||||
'log_ip' => $log_ip,
|
'log_ip' => !empty($log_ip) ? $log_ip : '',
|
||||||
'log_time' => $log_time,
|
'log_time' => $log_time,
|
||||||
'log_operation' => $log_operation,
|
'log_operation' => $log_operation,
|
||||||
);
|
);
|
||||||
|
|
|
@ -88,5 +88,14 @@ class phpbb_log_add_test extends phpbb_database_test_case
|
||||||
|
|
||||||
// Invalid mode specified
|
// Invalid mode specified
|
||||||
$this->assertFalse($log->add('mode_does_not_exist', $user_id, $log_ip, $log_operation, $log_time));
|
$this->assertFalse($log->add('mode_does_not_exist', $user_id, $log_ip, $log_operation, $log_time));
|
||||||
|
|
||||||
|
// null user and null ip given
|
||||||
|
$this->assertEquals(3, $log->add($mode, null, null, $log_operation, $log_time), 'Adding log with null user_id and null user_ip failed');
|
||||||
|
$sql = 'SELECT user_id, log_ip FROM ' . LOG_TABLE . ' WHERE log_id = 3';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
$this->assertEquals(ANONYMOUS, $row['user_id'], 'Adding log with null user_id failed');
|
||||||
|
$this->assertEquals('', $row['log_ip'], 'Adding log with null user_ip failed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue