Fix the handling of an empty list of participants
authorAlexander Ebert <ebert@woltlab.com>
Fri, 7 Jun 2024 10:03:24 +0000 (12:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 7 Jun 2024 10:03:24 +0000 (12:03 +0200)
files/lib/system/exporter/SMF2xExporter.class.php

index 9ad4368acfbcd6e5ad652c7253b8f209d2f91cce..c4966e90c79927b66f982d394cc402077fae92e6 100644 (file)
@@ -840,7 +840,12 @@ final class SMF2xExporter extends AbstractExporter
         $statement = $this->database->prepareStatement($sql);
         $statement->execute([$offset + 1, $offset + $limit]);
         while ($row = $statement->fetchArray()) {
-            $participants = \explode(',', $row['participants']);
+            if ($row['participants'] === null) {
+                $participants = [];
+            } else {
+                $participants = \explode(',', $row['participants']);
+            }
+
             $participants[] = $row['id_member_from'];
             $conversationID = $this->getConversationID($row['id_pm_head'], $participants);
 
@@ -890,7 +895,12 @@ final class SMF2xExporter extends AbstractExporter
         $statement = $this->database->prepareStatement($sql);
         $statement->execute([$offset + 1, $offset + $limit]);
         while ($row = $statement->fetchArray()) {
-            $participants = \explode(',', $row['participants']);
+            if ($row['participants'] === null) {
+                $participants = [];
+            } else {
+                $participants = \explode(',', $row['participants']);
+            }
+
             $participants[] = $row['id_member_from'];
             $conversationID = $this->getConversationID($row['id_pm_head'], $participants);