Problem/Motivation
On Drupal 11, visiting /admin/config/services/adminrss returns a 500:
ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in modules/contrib/adminrss/src/Form/AdminRssSettingsForm.php on line 32 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 45 of core/lib/Drupal/Core/Form/ConfigFormBase.php).
AdminRssSettingsForm overrides create() and calls parent::__construct($config_factory),
but on Drupal 11 ConfigFormBase::__construct() also requires a TypedConfigManagerInterface.
The module declares core_version_requirement: '>=9.5', so Drupal 11 sites can install it and hit this.
Seen on Drupal 11.4.7, PHP 8.4, adminrss 8.x-1.x-dev. The Drupal 12 Rector changes in #3595149: Automated Drupal 12 compatibility fixes for adminrss 1.x-dev do not touch this form.
Steps to reproduce
- Install adminrss on Drupal 11.
- Visit
/admin/config/services/adminrss.
Proposed resolution
Inject config.typed and pass it to the parent constructor:
public function __construct(
ConfigFactoryInterface $config_factory,
TypedConfigManagerInterface $typed_config_manager,
ViewsManager $views_manager,
) {
parent::__construct($config_factory, $typed_config_manager);
$this->viewsManager = $views_manager;
}
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory'),
$container->get('config.typed'),
$container->get('adminrss.views_manager'),
);
}This needs no change to core_version_requirement:
config.typed exists on every supported core, and on cores where the parent constructor
takes a single argument, PHP ignores the extra one.
Remaining tasks
- MR with the change above.
- A functional test that loads the settings form, so a constructor change in core fails CI instead of production.
User interface changes
None.
API changes
The AdminRssSettingsForm constructor gains a parameter. This only affects code that subclasses the form.
Data model changes
None.
Issue and MR created with AI.
Issue fork adminrss-3624483
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fgmComment #3
fgmComment #7
fgmComment #8
fgmComment #10
fgmMerged