From 9e55d3cb44b7dc803192cd043c0646850a23eeea Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 17 Jun 2023 00:46:38 +0700 Subject: [PATCH] [ticket/16470] Adjust user last visit time update logic Previous logic doesn't work correctly as session_time value got updated in regular manner, so that its 60 seconds lag with time_now can be unreachable in some cases. So update user_lastvisit if it lags for 60 sec of session_time. PHPBB3-16470 PHPBB3-14173 --- phpBB/phpbb/session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index a74a25e122..2b98b34ee2 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -441,7 +441,7 @@ class session $this->check_ban_for_current_session($config); // Update user last visit time accordingly, but in a minute or so - if ($this->time_now - $this->data['session_time'] > 60) + if ((int) $this->data['session_time'] - (int) $this->data['user_lastvisit'] > 60) { $this->update_user_lastvisit(); } @@ -691,7 +691,7 @@ class session $this->session_id = $this->data['session_id']; // Only sync user last visit time in a minute or so after last session data update or if the page changes - if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) + if ((int) $this->data['session_time'] - (int) $this->data['user_lastvisit'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) { // Update the last visit time $this->update_user_lastvisit();