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

  1. Install adminrss on Drupal 11.
  2. 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

Command icon 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

fgm created an issue. See original summary.

fgm’s picture

Issue summary: View changes
fgm’s picture

Issue summary: View changes

  • fgm committed 22a6764d on 8.x-1.x
    fix: #3624483 Settings form crashes on Drupal 11:...
    

fgm’s picture

Status: Active » Needs work
fgm’s picture

Status: Needs work » Needs review

  • fgm committed 0acc55a9 on 8.x-1.x
    fix: #3624483 complete D12 preparation
    
fgm’s picture

Status: Needs review » Fixed

Merged

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.