Skip to content

Commit

Permalink
fix: when setting CheckBox's default value to null [ref #1568]
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed May 16, 2023
1 parent 0433a11 commit 596d117
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion var/Typecho/Widget/Helper/Form/Element/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function input(?string $name = null, ?array $options = null): ?Layout
*/
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');
Expand Down

0 comments on commit 596d117

Please sign in to comment.