[Web] Archive setting of a mailbox: accept true and false

This commit is contained in:
FreddleSpl0it committed 2026-11-09 01:05:16 +01:00
1 parent 043029137a
commit 2fc6868b72
2 files changed
+4 -1

No files matched your search

@@ -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;
}
+2
View File
@@ -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],
];
}