Checkbox default values stored as strings instead of booleans.

Created on 9 June 2025, about 2 months ago

Problem/Motivation

The default values for several checkbox settings (`youtube_nocookie`, `youtube_autoload`, `youtube_short`) in the `LiteYoutubeFormatter` class are stored as strings (`'false'` and `'true'`) rather than booleans (`false` and `true`).
This inconsistency can cause:

  • Logical errors during type-sensitive comparisons (e.g., strict comparisons using `===`).
  • Misbehavior in frontend integrations, where boolean values are expected but strings are provided.
  • Increased complexity and potential fragility in the codebase due to implicit type conversions.

Steps to reproduce

  1. Review the `defaultSettings()` method in the `LiteYoutubeFormatter` class.
  2. Observe that the values for `youtube_nocookie`, `youtube_autoload`, and `youtube_short` are defined as `'false'` or `'true'` strings.
  3. Use these settings in conditions or JavaScript integrations where boolean values are expected.

Proposed resolution

  1. Update the `defaultSettings()` method to use boolean values (`false` and `true`) for the affected settings:
public static function defaultSettings(): array {  
	return [  
    	...  
    	'youtube_nocookie' => false,  
    	'youtube_autoload' => false,  
    	'youtube_short' => false,  
    	... 
}  

Remaining tasks

  • Update the `defaultSettings()` method.
  • Audit the codebase for any instances where the affected settings are being accessed or compared.
  • Update unit tests to verify the correct handling of boolean values.

User interface changes

No direct user interface changes are expected.

API changes

No API changes are expected.

Data model changes

No data model changes are expected.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΎUruguay apereira23

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024