From 10004c4032a86364c834574a670032d2676b87cb Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 8 Mar 2016 12:36:29 +0100 Subject: [PATCH] [ticket/14132] Use transaction for adding notifications to type table This will prevent a race condition that might occur by two posts being submitted at the same time with the notification type IDs not being cached. PHPBB3-14132 --- phpBB/phpbb/notification/manager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index db92170dd8..233d65eebe 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -923,6 +923,8 @@ class manager { $notification_type_ids = $this->cache->get('notification_type_ids'); + $this->db->sql_transaction('begin'); + if ($notification_type_ids === false) { $notification_type_ids = array(); @@ -957,6 +959,8 @@ class manager $this->cache->put('notification_type_ids', $notification_type_ids); } + $this->db->sql_transaction('commit'); + return $notification_type_ids[$notification_type_name]; }