WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 19 months ago

#40025 closed defect (bug) (invalid)

Customer checkbox control is checked when the default value is false.

Reported by: gandham Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: Customize Keywords:
Focuses: Cc:

Description

If we set the default value of the setting as boolean false, not "false", checkbox on the customiser is checked.
If I set the default value to 0, it is working as expected.

Should a boolean false be treated as false?

Customiser saves the false value as 0 and true value as 1, when actually saving to the db.

Attachments (1)

customize-bug.png (86.6 KB) - added by gandham 4 years ago.

Download all attachments as: .zip

Change History (3)

@gandham
4 years ago

#1 @westonruter
4 years ago

  • Keywords reporter-feedback added

@gandham Please provide a standalone plugin with code that demonstrates the issue you're having.

From your screenshot, I see you have “flase” (a mispelling). In PHP, if you try to use flase you'll get:

Notice: Use of undefined constant flase - assumed 'flase'

In other words, it converts flase into a string 'flase' and this would then be interpreted as boolean true, and result in the checkbox being checked.

#2 @pento
19 months ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This appears to be caused by the misspelling of false.

Note: See TracTickets for help on using tickets.