Allow `null` in `TUnsupportedDefaultValue`
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 11 Apr 2022 11:51:00 +0000 (13:51 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 11 Apr 2022 11:51:58 +0000 (13:51 +0200)
When fetching the column definition from the database MySQL will return `null`
as the default value for BLOB and TEXT column even if the column itself is
`NOT NULL`.

wcfsetup/install/files/lib/system/database/table/column/TUnsupportedDefaultValue.class.php

index 79f2f14d1dd4edb5a7af8ec4dcceafcb7a5cf82e..368de96f3b623503f9ba1ed23637840af1762c51 100644 (file)
@@ -15,6 +15,10 @@ trait TUnsupportedDefaultValue
 {
     public function defaultValue($defaultValue)
     {
-        throw new \BadMethodCallException("Default values for BLOB or TEXT columns are unsupported.");
+        if ($defaultValue !== null) {
+            throw new \BadMethodCallException("Default values for BLOB or TEXT columns are unsupported.");
+        }
+
+        return $this;
     }
 }