Fix several 'deprecated' issues in the PHPBB3.1+ exporter
authorMarcel Werk <burntime@woltlab.com>
Tue, 7 May 2024 11:56:08 +0000 (13:56 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 7 May 2024 11:56:08 +0000 (13:56 +0200)
files/lib/system/exporter/PhpBB31xExporter.class.php

index d1011b5e66cc0e7af79387be499d7c0b33a4dac9..df2b033b3e5fff0649f85f70b7e969cb862ca5b7 100644 (file)
@@ -393,7 +393,7 @@ final class PhpBB31xExporter extends AbstractExporter
             ];
 
             $additionalData = [
-                'groupIDs' => \explode(',', $row['groupIDs']),
+                'groupIDs' => \explode(',', $row['groupIDs'] ?: ''),
                 'languages' => [$row['user_lang']],
                 'options' => $options,
             ];
@@ -853,7 +853,7 @@ final class PhpBB31xExporter extends AbstractExporter
         $statement->execute([0]);
         while ($row = $statement->fetchArray()) {
             if (!$row['isDraft']) {
-                $participants = \explode(',', $row['participants']);
+                $participants = \explode(',', $row['participants'] ?: '');
                 $participants[] = $row['author_id'];
                 $conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
 
@@ -866,7 +866,7 @@ final class PhpBB31xExporter extends AbstractExporter
                 'subject' => StringUtil::decodeHTML($row['message_subject']),
                 'time' => $row['message_time'],
                 'userID' => $row['author_id'],
-                'username' => StringUtil::decodeHTML($row['username']) ?: '',
+                'username' => StringUtil::decodeHTML($row['username'] ?: ''),
                 'isDraft' => $row['isDraft'],
             ];
 
@@ -951,14 +951,14 @@ final class PhpBB31xExporter extends AbstractExporter
         $statement = $this->database->prepareStatement($sql, $limit, $offset);
         $statement->execute([1, 0]);
         while ($row = $statement->fetchArray()) {
-            $participants = \explode(',', $row['participants']);
+            $participants = \explode(',', $row['participants'] ?: '');
             $participants[] = $row['author_id'];
             $conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
 
             $data = [
                 'conversationID' => $conversationID,
                 'userID' => $row['author_id'],
-                'username' => StringUtil::decodeHTML($row['username']) ?: '',
+                'username' => StringUtil::decodeHTML($row['username'] ?: ''),
                 'message' => self::fixBBCodes($row['message_text'], $row['bbcode_uid']),
                 'time' => $row['message_time'],
                 'attachments' => $row['attachments'],
@@ -1009,16 +1009,16 @@ final class PhpBB31xExporter extends AbstractExporter
         $statement = $this->database->prepareStatement($sql, $limit, $offset);
         $statement->execute();
         while ($row = $statement->fetchArray()) {
-            $participants = \explode(',', $row['participants']);
+            $participants = \explode(',', $row['participants'] ?: '');
             $participants[] = $row['author_id'];
             $conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
 
-            $bcc = \explode(':', $row['bcc_address']);
+            $bcc = \explode(':', $row['bcc_address'] ?: '');
 
             $data = [
                 'conversationID' => $conversationID,
                 'participantID' => $row['user_id'],
-                'username' => StringUtil::decodeHTML($row['username']) ?: '',
+                'username' => StringUtil::decodeHTML($row['username'] ?: ''),
                 'hideConversation' => $row['pm_deleted'],
                 'isInvisible' => \in_array('u_' . $row['user_id'], $bcc) ? 1 : 0,
                 'lastVisitTime' => $row['pm_new'] ? 0 : $row['message_time'],
@@ -1228,8 +1228,8 @@ final class PhpBB31xExporter extends AbstractExporter
             $data = [
                 'threadID' => $row['topic_id'],
                 'userID' => $row['poster_id'],
-                'username' => $row['post_username'] ?: (StringUtil::decodeHTML($row['username']) ?: ''),
-                'subject' => StringUtil::decodeHTML($row['post_subject']),
+                'username' => $row['post_username'] ?: StringUtil::decodeHTML($row['username'] ?: ''),
+                'subject' => StringUtil::decodeHTML($row['post_subject'] ?: ''),
                 'message' => self::fixBBCodes($row['post_text'], $row['bbcode_uid']),
                 'time' => $row['post_time'],
                 'isDisabled' => $row['post_visibility'] == self::ITEM_UNAPPROVED ? 1 : 0,