Fix issue when importing comments from wordpress
authorMarcel Werk <burntime@woltlab.com>
Thu, 16 Feb 2023 11:19:03 +0000 (12:19 +0100)
committerMarcel Werk <burntime@woltlab.com>
Thu, 16 Feb 2023 11:19:03 +0000 (12:19 +0100)
Comments assigned to a parent comment that no longer exists resulted in an error.

files/lib/system/exporter/WordPress3xExporter.class.php

index 207b364bf273ac27ca68c73942f8e30082b76df0..903fa9f562145b0b040664ca093833451cc6df2a 100644 (file)
@@ -434,6 +434,11 @@ class WordPress3xExporter extends AbstractExporter
                     $parentCommentStatement->execute([$parentID]);
                     $row2 = $parentCommentStatement->fetchArray();
 
+                    if ($row2 === false) {
+                        // Skip because parent comment is missing.
+                        break;
+                    }
+
                     if (!$row2['comment_parent']) {
                         $data = [
                             'commentID' => $row2['comment_ID'],