From 9c497a7b462a24b980912af669a44bfb82f5bdc2 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 31 May 2014 13:34:04 +0200 Subject: [PATCH] [ticket/12639] Add a test case with an empty keywords list PHPBB3-12639 --- phpBB/phpbb/log/log.php | 2 +- tests/log/delete_test.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 6217a7fe46..0dce9306df 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -395,7 +395,7 @@ class log implements \phpbb\log\log_interface { if ($field == 'keywords') { - $sql_where .= $this->generate_sql_keyword($field_value, '', ''); + $sql_where .= $this->generate_sql_keyword($field_value, '', ' AND'); } else { diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php index f10e3e582b..14895de059 100644 --- a/tests/log/delete_test.php +++ b/tests/log/delete_test.php @@ -56,5 +56,10 @@ class phpbb_log_delete_test extends phpbb_database_test_case $this->assertCount(3, $log->get_logs('critical', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC')); $log->delete('critical', array('user_id' => array('>', 1))); $this->assertCount(1, $log->get_logs('critical', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC')); + + // Delete with an empty keyword list + $this->assertCount(1, $log->get_logs('critical', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC')); + $log->delete('critical', array('keywords' => '')); + $this->assertEmpty($log->get_logs('critical', false, 0, 0, 0, 0, 0, 0, 'l.log_time DESC')); } }