diff --git a/data/web/inc/lib/mailcow/Archive/Model/Mailbox.php b/data/web/inc/lib/mailcow/Archive/Model/Mailbox.php index 41575c6e2..7fdc62d67 100644 --- a/data/web/inc/lib/mailcow/Archive/Model/Mailbox.php +++ b/data/web/inc/lib/mailcow/Archive/Model/Mailbox.php @@ -34,9 +34,10 @@ class Mailbox ); } - /** Mailbox setting as stored: '1', '0', anything else (also a missing attribute) is 'inherit' */ + /** Mailbox setting: '1', '0' (also as number or boolean), anything else (also a missing attribute) is 'inherit' */ public static function setting(mixed $value): string { + $value = is_bool($value) ? (int)$value : $value; $value = is_scalar($value) ? (string)$value : ''; return in_array($value, ['0', '1'], true) ? $value : self::INHERIT; } diff --git a/tests/php/Archive/Model/MailboxTest.php b/tests/php/Archive/Model/MailboxTest.php index 954788b84..49d0937d6 100644 --- a/tests/php/Archive/Model/MailboxTest.php +++ b/tests/php/Archive/Model/MailboxTest.php @@ -28,6 +28,8 @@ class MailboxTest extends TestCase 'on as number' => [1, 0, true], 'off' => ['0', 1, false], 'off as number' => [0, 1, false], + 'on as boolean' => [true, 0, true], + 'off as boolean' => [false, 1, false], ]; }