From f9a961085ff5f97921a0c9830c5eea5955e6dd31 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 2 Apr 2020 11:16:55 +0200 Subject: [PATCH] if session is already closed, reopen it for push-notification, as we need to store if a push message is already delivered --- notifications/inc/class.notifications_push.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/notifications/inc/class.notifications_push.inc.php b/notifications/inc/class.notifications_push.inc.php index 4404b0e14c..3d9287415f 100644 --- a/notifications/inc/class.notifications_push.inc.php +++ b/notifications/inc/class.notifications_push.inc.php @@ -39,6 +39,10 @@ class notifications_push implements Json\PushBackend public static function get() { + if (session_status() === PHP_SESSION_NONE) + { + $session_reopened = session_start(); + } $already_send =& Api\Cache::getSession(__CLASS__, 'already_send'); $max_id = Api\Cache::getInstance(__CLASS__, 'max_id'); @@ -72,6 +76,10 @@ class notifications_push implements Json\PushBackend $already_send = $row['notify_id']; } } + if (!empty($session_reopened)) + { + session_write_close(); + } //error_log(__METHOD__."() max_id=$max_id, already_sent=$already_send"); }