Problem/Motivation

When enabling the module in Drupal 11.0.5, I am getting this error when trying to configure it:

[24-Oct-2024 09:27:03 America/Chicago] Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /modules/contrib/search404/src/Form/Search404Settings.php on line 47 and exactly 2 expected" at /core/lib/Drupal/Core/Form/ConfigFormBase.php line 43

The code in the module looks like this:

  public function __construct(ConfigFactoryInterface $configFactory, ModuleHandlerInterface $module_handler) {
    parent::__construct($configFactory);
    $this->moduleHandler = $module_handler;
  }


The parent construct looks like this:

  public function __construct(
    ConfigFactoryInterface $config_factory,
    protected TypedConfigManagerInterface $typedConfigManager,

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 construct_issue-3483211.patch1.32 KBsarwan_verma

Issue fork search404-3483211

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

camoa created an issue. See original summary.

sarwan_verma’s picture

Assigned: Unassigned » sarwan_verma
sarwan_verma’s picture

Assigned: sarwan_verma » Unassigned
Status: Active » Needs review
StatusFileSize
new1.32 KB

Hi,

I have fixed the "Error trying to configure Search404 in Drupal 11.0.5" issue and attached a patch.
Please review and verify it.

Thanks!

camoa’s picture

Why not use the Issue fork?

I believe that is a better practice.

robcarr’s picture

Status: Needs review » Reviewed & tested by the community

This seems to be a really common problem with contrib modules applied in a D11 site. Patch works - it's practically the same fix for every other module. Thank you @sarwan_verma for your work

anybody’s picture

Priority: Normal » Major

I can confirm the settings page is entirely broken with Drupal 11!

anybody’s picture

Assigned: Unassigned » grevil

@Grevil could you review and fix this maybe?

anybody’s picture

Status: Reviewed & tested by the community » Needs review

The patch in #3 fixes the issue for Drupal 11 - I'm just not sure, how backwards-compatible it is.

grevil’s picture

Status: Needs review » Needs work

Yea, pretty simple fix! Seems like we generally had a miscommunication in https://www.drupal.org/project/search404/issues/3434362#comment-15583056.

grevil’s picture

Assigned: grevil » Unassigned

I'm just not sure, how backwards-compatible it is.

It's not. We need to drop D9 compatibility. But I am unsure, why we even kept it in.

anybody’s picture

Ok, drop it!

anybody’s picture

Status: Needs work » Reviewed & tested by the community
anybody’s picture

Status: Reviewed & tested by the community » Fixed

  • anybody committed e5793556 on 2.x authored by grevil
    Issue #3483211 by sarwan_verma, grevil, anybody: Error trying to...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.