fix: when setting CheckBox's default value to null [ref #1568]

This commit is contained in:
joyqi 2023-05-16 12:33:49 +08:00
parent 0433a11c0a
commit 596d117210
2 changed files with 2 additions and 3 deletions

View File

@ -1031,8 +1031,7 @@ function install_step_2_perform()
->addRule('dbFile', 'required', _t('确认您的配置'))
->addRule('dbFile', function (string $path) {
$pattern = "/^(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i";
if (strstr(PHP_OS, 'WIN'))
{
if (strstr(PHP_OS, 'WIN')) {
$pattern = "/(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i";
}
return !!preg_match($pattern, $path);

View File

@ -61,7 +61,7 @@ class Checkbox extends Element
*/
protected function inputValue($value)
{
$values = is_array($value) ? $value : [$value];
$values = is_null($value) ? [] : (is_array($value) ? $value : [$value]);
foreach ($this->options as $option) {
$option->removeAttribute('checked');