Module is not working in drupal 9.5.10

Created on 15 March 2024, over 1 year ago

Problem/Motivation

Too few arguments to function Drupal\comment\CommentForm::__construct(), 6 passed in /modules/contrib/ajax_comments/src/Form/AjaxCommentsForm.php on line 83 and exactly 8 expected in Drupal\comment\CommentForm->__construct() (line 109 of core/modules/comment/src/CommentForm.php

Steps to reproduce

install the module, enable it and load node.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Needs work

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia vinodjethwani

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @vinodjethwani
  • The "Too few arguments" error when enabling the ajax_comments module indicates it's trying to use Drupal core's CommentForm constructor with an insufficient number of arguments, likely due to incompatibility with your Drupal core version. The best solutions are to update the ajax_comments module to a compatible release or to patch its code (AjaxCommentsForm.php) to pass the correct number and type of arguments cat language translator to the core CommentForm constructor by injecting the necessary services. As a temporary fix, disabling the ajax_comments module will resolve the fatal error. Always check module compatibility with your Drupal core version and back up your site before making changes.

  • The error "Too few arguments to function Drupal\comment\CommentForm::__construct()" indicates that the ajax_comments module is attempting to call a core Drupal comment form constructor with 6 arguments, but your current Drupal core version expects 8. This is a compatibility issue, likely due to an outdated ajax_comments module or a recent Drupal core upgrade. To fix it, you need to update the ajax_comments module to a version that is compatible with your Drupal core (e.g., using composer require drupal/ajax_comments:^x.y) and then clear your caches. If no compatible MyKFCExperience Survey version exists, consider an alternative module or contributing to the ajax_comments project.

  • This error message means that the constructor for the CommentForm class in Drupal expects 8 arguments, but the Ajax Comments module is only passing 6 arguments when it calls the constructor. This usually happens when a contrib module is outdated compared to the core Drupal version. Check if there's an updated ajax_comments module version compatible with your Drupal core version. Go to the line mentioned (line 83) where CommentForm::__construct() is called and adjust the number of arguments. Find the new arguments that were added. Pass the required 8 arguments instead of 6 hctra org In your AjaxCommentsForm class, inject the new services (form_builder and event_dispatcher) through the constructor and the service container.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    avpaderno โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
Production build 0.71.5 2024