WBB 4.x: Fix PHP 8.1 compatibility with NULL values in board title / description
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 4 Mar 2022 10:59:04 +0000 (11:59 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 4 Mar 2022 10:59:04 +0000 (11:59 +0100)
> Message: strpos(): Passing null to parameter #1 ($haystack) of type string is
> deprecated

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

index ce70a0ca13bd2d62ba515f14695af52175207972..1fa503954052dbec27c4c76d81dcc0c0300b092a 100644 (file)
@@ -1180,6 +1180,9 @@ class WBB4xExporter extends AbstractExporter
         $statement->execute();
         $i18nValues = [];
         while ($row = $statement->fetchArray()) {
+            $row['title'] = $row['title'] ?? '';
+            $row['description'] = $row['description'] ?? '';
+
             $this->boardCache[$row['parentID']][] = $row;
 
             if (\strpos($row['title'], 'wbb.board.board') === 0) {