Can not be disabled via the config form

Created on 26 February 2024, 4 months ago
Updated 3 April 2024, 3 months ago

Problem/Motivation

There is a setting to allow disable the anti-virus scan in the config form (/admin/config/httpav).
But this setting is not working.

Steps to reproduce

  1. Go to the config form (/admin/config/httpav)
  2. Disable the scan by untick the 'Enable' box.
  3. Save the setting.
  4. After saving the form, the 'Enable' checkbox is ticked again.

Proposed resolution

The bug is introduced by line 42 in /src/Form/ConfigForm.php

https://git.drupalcode.org/project/httpav/-/blob/1.1.1/src/Form/ConfigFo...

'#default_value' => $config->get('enabled') ?: TRUE,

The line above means that if the config value is false or 0, then set it to TRUE. Therefore, this value can never be false.

If that line is changed to

'#default_value' => $config->get('enabled') ?? TRUE,

Then the scan can be disabled by this config form.

Remaining tasks

Review the proposed fix.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

๐Ÿ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia Mingsong ๐Ÿ‡ฆ๐Ÿ‡บ

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024