SMF: Fix attachment export for SMF 2.1
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 28 Jul 2023 08:59:00 +0000 (10:59 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 28 Jul 2023 08:59:00 +0000 (10:59 +0200)
files/lib/system/exporter/SMF2xExporter.class.php

index 79384c21bb6da3d88d48e4959f7499118a5967f6..29a0d7da65b3b642e17818babe66430f5caa3946 100644 (file)
@@ -14,6 +14,7 @@ use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
 use wcf\util\FileUtil;
+use wcf\util\JSON;
 use wcf\util\MessageUtil;
 use wcf\util\StringUtil;
 use wcf\util\UserRegistrationUtil;
@@ -1798,7 +1799,13 @@ class SMF2xExporter extends AbstractExporter
             // multiple attachments dir
             static $dirs;
             if ($dirs === null) {
-                $dirs = \unserialize($this->readOption('attachmentUploadDir'));
+                try {
+                    // SMF 2.1
+                    $dirs = JSON::decode($this->readOption('attachmentUploadDir'));
+                } catch (\Exception $e) {
+                    // SMF 2.0
+                    $dirs = \unserialize($this->readOption('attachmentUploadDir'));
+                }
             }
 
             if (isset($dirs[$dir])) {