From 5eae53d5ce9d461a50c612cc4bb307ec96858d62 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 11 Apr 2022 13:51:00 +0200 Subject: [PATCH] Allow `null` in `TUnsupportedDefaultValue` 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`. --- .../table/column/TUnsupportedDefaultValue.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/database/table/column/TUnsupportedDefaultValue.class.php b/wcfsetup/install/files/lib/system/database/table/column/TUnsupportedDefaultValue.class.php index 79f2f14d1d..368de96f3b 100644 --- a/wcfsetup/install/files/lib/system/database/table/column/TUnsupportedDefaultValue.class.php +++ b/wcfsetup/install/files/lib/system/database/table/column/TUnsupportedDefaultValue.class.php @@ -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; } } -- 2.20.1