Problem/Motivation

An error appears when trying to open the Varbase Media Header settings page.

ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /var/www/html/docroot/modules/contrib/varbase_media_header/src/Form/VarbaseMediaHeaderSettingsForm.php on line 66 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 44 of core/lib/Drupal/Core/Form/ConfigFormBase.php).

Steps to reproduce

  • Install the Varbase Media Header module on a Varbase site using Drupal 11.
  • Enable the module.
  • Navigate to /admin/config/varbase/varbase-media-header.
  • An error appears on the page.

Proposed resolution

Resolve the compatibility issue between the custom class and the ConfigFormBase class.

Remaining tasks

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

CommentFileSizeAuthor
#2 3518954-2.patch2.64 KBqusai taha
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

qusai taha created an issue. See original summary.

qusai taha’s picture

Assigned: qusai taha » Unassigned
Status: Active » Needs review
StatusFileSize
new2.64 KB

rajab natshah’s picture

Title: Fix Issue ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), » Fix ArgumentCountError in VarbaseMediaHeaderSettingsForm constructor
rajab natshah’s picture

rajab natshah’s picture

Assigned: Unassigned » s.halawani
Issue summary: View changes
Issue tags: +varbase-10.0.5, +varbase_media_header-10.0.4
rajab natshah’s picture

Assigned: s.halawani » rajab natshah
Status: Needs review » Needs work

Fixed to work with Drupal 11
But facing the following issues in Drupal 10

PHP Fatal error:  Type of Drupal\varbase_media_header\Form\VarbaseMediaHeaderSettingsForm::$typedConfigManager must not be defined (as in class Drupal\Core\Form\ConfigFormBase) in /app/docroot/modules/contrib/varbase_media_header/src/Form/VarbaseMediaHeaderSettingsForm.php on line 22
 [error]  RuntimeException: Recursive router rebuild detected. in Drupal\Core\Routing\RouteBuilder->rebuild() (line 121 of /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php) #0 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(210): Drupal\Core\Routing\RouteBuilder->rebuild()
#1 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(222): Drupal\Core\Routing\RouteBuilder->rebuildIfNeeded()
#2 /app/docroot/core/lib/Drupal/Core/DrupalKernel.php(723): Drupal\Core\Routing\RouteBuilder->destruct()
#3 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(314): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
#4 [internal function]: Drush\Boot\DrupalBoot8->terminate()
#5 {main}. 
RuntimeException: Recursive router rebuild detected. in /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php on line 121 #0 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(210): Drupal\Core\Routing\RouteBuilder->rebuild()
#1 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(222): Drupal\Core\Routing\RouteBuilder->rebuildIfNeeded()
#2 /app/docroot/core/lib/Drupal/Core/DrupalKernel.php(723): Drupal\Core\Routing\RouteBuilder->destruct()
#3 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(314): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
#4 [internal function]: Drush\Boot\DrupalBoot8->terminate()
#5 {main}
RuntimeException: Recursive router rebuild detected. in Drupal\Core\Routing\RouteBuilder->rebuild() (line 121 of /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php).
PHP Fatal error:  Type of Drupal\varbase_media_header\Form\VarbaseMediaHeaderSettingsForm::$typedConfigManager must not be defined (as in class Drupal\Core\Form\ConfigFormBase) in /app/docroot/modules/contrib/varbase_media_header/src/Form/VarbaseMediaHeaderSettingsForm.php on line 22
 [warning] Drush command terminated abnormally.

rajab natshah’s picture

Status: Needs work » Active

  • rajab natshah committed d43dec67 on 10.1.x
    Issue #3518954: Fix Recursive router rebuild detected for the defined...

  • rajab natshah committed c73abf2d on 10.0.x
    Issue #3518954: Fix Recursive router rebuild detected for the defined...
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Active » Fixed
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

ahmad khader’s picture

@Rajab,
i'm still receiving PHP Fatal error: Type of Drupal\varbase_media_header\Form\VarbaseMediaHeaderSettingsForm::$typedConfigManager changing protected $typedConfigManager; to protected TypedConfigManagerInterface $typedConfigManager; fixed it.

rajab natshah’s picture

Drupal 10 or Drupal 11?
PHP version? PHP 8.3 or something else?
DDEV, Lando, or LAMP?

rajab natshah’s picture

Thanks, Ahmad, for following up and reporting!

I confirm the issue

I found what wrong
No need to define ( protected $typedConfigManager; )
and the order to pass in the __construct

ConfigFormBas, and ConfigFormBaseTrait has protected passed to the __construct

Committing and doing a quick fix release.

  • rajab natshah committed 8147f858 on 10.1.x
    Issue #3518954: Fix ArgumentCountError in VarbaseMediaHeaderSettingsForm...

  • rajab natshah committed 7c05bbaf on 10.0.x
    Issue #3518954: Fix ArgumentCountError in VarbaseMediaHeaderSettingsForm...

  • rajab natshah committed 506b40ad on 9.1.x
    Issue #3518954: Fix ArgumentCountError in VarbaseMediaHeaderSettingsForm...

rajab natshah’s picture

rajab natshah’s picture

rajab natshah’s picture

rajab natshah’s picture

Issue summary: View changes

✅ Released varbase-10.0.5

Status: Fixed » Closed (fixed)

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

rajab natshah’s picture

Issue summary: View changes

✅ Released varbase-9.1.10

rajab natshah’s picture

Issue summary: View changes