Problem/Motivation

After installing this module, try to access /admin/config/media/smart-image-optimizer. A fatal error occurs, as shown below:

ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /var/www/html/xxxxxx/web/modules/contrib/smart_image_optimizer/src/Form/SettingsForm.php on line 33 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 46 of /var/www/html/xxxxx/web/core/lib/Drupal/Core/Form/ConfigFormBase.php).

Steps to reproduce

  1. Install Drupal 11.x
  2. Install the smart_image_optimizer module
  3. Navigate to /admin/config/media/smart-image-optimizer

Expected

The Smart Image Optimizer settings form loads correctly without any errors.

Actual

Fatal error: ArgumentCountError: Too few arguments to function...

Proposed resolution

Update SettingsForm::__construct() and SettingsForm::create()

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

dkmishra created an issue. See original summary.

dkmishra’s picture

Status: Active » Needs review
vinodhini.e’s picture

Hi,

Tested on Drupal 11.4.5 and was able to reproduce the issue.

Applied MR !3 and retested.

The settings page now loads correctly without any errors, and the issue is resolved.

nishant made their first commit to this issue’s fork.

  • nishant committed 21685a8e on 1.0.x
    Issue #3606682: Fixed SettingsForm constructor is incompatible issue
    
nishant’s picture

MR merged,

Thanks @vinodhini.e and @dkmishra.

nishant’s picture

Status: Needs review » Fixed

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.

nishant’s picture

Status: Fixed » Closed (fixed)