Problem/Motivation
Several call sites pass a default value as a second argument to Config::get():
$default_case = $config->get('default_case', 'standard'); $enable_attributes = $config->get('enable_attributes', FALSE);
Drupal\Core\Config\ConfigBase::get() is declared as get($key = '') and takes a single argument, so the second one is silently discarded and the intended default never applies. The code reads as if a fallback were in place when there is none.
Affected call sites on 4.0.x-dev:
src/Form/BlockClassBulkOperationsForm.php:42—get('enable_attributes', FALSE)src/Form/BlockClassBulkOperationsForm.php:71—get('enable_id_replacement', FALSE)src/Service/BlockClassHelperService.php:80—get('default_case', 'standard')src/Service/BlockClassHelperService.php:813—get('default_case', 'standard')src/Service/BlockClassHelperService.php:1129—get('default_case', 'standard')block_class.module:133—get('default_case', 'standard')
Steps to reproduce
Not user-facing — block_class.settings ships default_case, enable_attributes and enable_id_replacement in config/install, so the discarded defaults are never needed in practice. This is a readability and correctness clean-up, not a behaviour fix.
Proposed resolution
Drop the second argument at all six call sites, as proposed in MR !5 on the closed issue #3279758. Where a fallback is genuinely wanted, make it explicit at the call site instead.
Remaining tasks
- Open a merge request against 4.0.x, crediting hswong3i for the original change in MR !5.
- Review and test.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
csakiistvan