Skip to content

[1.x] fix: allow boolean settings with truthy defaults to be disabled - #4783

Closed
huoxin233 wants to merge 1 commit into
flarum:1.xfrom
huoxin233:huoxin/1.x-fix-boolean-setting-fallback
Closed

[1.x] fix: allow boolean settings with truthy defaults to be disabled#4783
huoxin233 wants to merge 1 commit into
flarum:1.xfrom
huoxin233:huoxin/1.x-fix-boolean-setting-fallback

Conversation

@huoxin233

Copy link
Copy Markdown
Contributor

Fixes #4781

Changes proposed in this pull request:

Backport fix #4782 to 1.x

Reviewers should focus on:

Screenshot

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)

@huoxin233
huoxin233 requested a review from a team as a code owner June 26, 2026 10:36
@imorland

imorland commented Aug 3, 2026

Copy link
Copy Markdown
Member

Thanks for the thorough diagnosis in #4781, @huoxin233 — and #4782 is the right fix for 2.x, where buildSettingComponent passes a setting's default through as the fallback, so a truthy default genuinely gets forced back on.

On 1.x, though, that trigger doesn't exist. 1.x's buildSettingComponent calls setting() without a fallback for boolean settings, and no core caller passes a truthy fallback — so fallback is always '', and '' || '' and '' ?? '' behave identically. There's no code path in 1.x core where this change alters behaviour.

The only way to encounter it on 1.x is an extension passing a truthy fallback to setting() for a boolean, which is easily handled extension-side (omit the truthy fallback, or read the default explicitly).

With 1.x now in security/critical-fix-only wind-down ahead of its end of life, we're keeping changes to it minimal, so I'm going to close this one for 1.x. The fix lives on where it's actually needed, in #4782 for 2.x. Really appreciate the report and the clear write-up. 🙏

@imorland imorland added the wontfix This will not be worked on label Aug 3, 2026
@imorland imorland closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants