Fix LicenseApi::clearLicenseFile()
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Sep 2023 14:08:01 +0000 (16:08 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Sep 2023 14:08:01 +0000 (16:08 +0200)
wcfsetup/install/files/lib/system/package/license/LicenseApi.class.php

index 9d2726db2eacf603b5b3bb1a88c1863f7fa53659..fbc0f0c9a4ee3af760ae8a37b22f3b0680c39ff2 100644 (file)
@@ -28,8 +28,10 @@ final class LicenseApi
 
     public function updateLicenseFile(?LicenseData $data): void
     {
+        $creationDate = $data?->creationDate ?? new \DateTimeImmutable();
+
         $writer = new AtomicWriter(self::LICENSE_FILE);
-        $writer->write("<?php /* {$data->creationDate->format('c')} */\n\n");
+        $writer->write("<?php /* {$creationDate->format('c')} */\n\n");
         $writer->write(\sprintf("return unserialize(%s);\n", \var_export(\serialize($data), true)));
         $writer->flush();