From 6f40960071129aafc2218ec23264c90af75fbad4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 23 Nov 2011 22:56:24 +0100 Subject: [ticket/10461] Correct $log_count check in view_log() so we show logs again. We pass $log_count as false now when we do not need to know how many log entries there are. However when $log_count is false, $log_count == 0 will be true as well and thus we will return early with 0. PHPBB3-9874 PHPBB3-10461 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 513b7a68b2..3916e769ac 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2609,7 +2609,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id $db->sql_freeresult($result); } - if ($log_count == 0) + if ($log_count === 0) { // Save the queries, because there are no logs to display return 0; -- cgit v1.2.1 From a72ea2bc98bd75bf02414e6e5c7723c9ec47a97d Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Wed, 23 Nov 2011 18:09:33 -0500 Subject: [ticket/10461] Add a comment explaining the logic here. PHPBB3-10461 --- phpBB/includes/functions_admin.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'phpBB') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 3916e769ac..526bc16ff0 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2609,6 +2609,10 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id $db->sql_freeresult($result); } + // $log_count may be false here if false was passed in for it, + // because in this case we did not run the COUNT() query above. + // If we ran the COUNT() query and it returned zero rows, return; + // otherwise query for logs below. if ($log_count === 0) { // Save the queries, because there are no logs to display -- cgit v1.2.1