Problem/Motivation

Just installed the module on a Drupal 10.3.x site, enabled some options in the configuration, added the field, added a node, and got this fatal error:

TypeError: Drupal\forward\Form\ForwardForm::__construct(): Argument #11 ($event_dispatcher) must be of type Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher, Symfony\Component\EventDispatcher\EventDispatcher given, called in /var/www/html/web/modules/contrib/forward/src/Form/ForwardForm.php on line 237 in Drupal\forward\Form\ForwardForm->__construct() (line 182 of modules/contrib/forward/src/Form/ForwardForm.php).
Drupal\forward\Form\ForwardForm::create(Object) (Line: 41)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('\Drupal\forward\Form\ForwardForm') (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject(Object, '\Drupal\forward\Form\ForwardForm') (Line: 58)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 736)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Issue fork forward-3443323

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

kopeboy created an issue. See original summary.

Praveen rani’s picture

Assigned: Unassigned » Praveen rani

Praveen rani’s picture

Assigned: Praveen rani » Unassigned
Status: Active » Needs review

To resolve the above issue, I have created MR. Please review changes.

john.oltman’s picture

Version: 4.0.2 » 4.0.x-dev
Status: Needs review » Needs work

Thanks for the MR. There are a few issues that need fixing:

* Should be a blank line above the comment block above the class and after the last use statement (used to be there)
* The old use statement for ContainerAwareEventDispatcher can be removed
* The doc block for the __construct needs to be updated for the $event_dispatcher variable

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

atul_ghate’s picture

Status: Needs work » Needs review

I have added the MR as per suggestion #5. Please review.

rajdip_755’s picture

StatusFileSize
new204.22 KB

Hi everyone!

I'm trying to review the MR 4 but I'm unable to reproduce the same issue mentioned in the description.

  1. While I'm trying to replicate the by installing the latest version of this module(4.0.2) using the composer then getting a different issue. The screenshot of the issue attached herewithcomposer issue
  2. But, if we are trying to replicate by cloning the target branch i.e 4.0.x of this project, then none of the issue is encountered.

It will be helpful if someone please mention the steps to reproduce for the issue mentioned in the description.

Thanks in advance!

john.oltman’s picture

Status: Needs review » Needs work

The order of the parameters to the "dispatch" function is now backwards when using the new interface - they need to be reversed. Setting issue back to "needs work" so the MR can be adjusted.

brunodbo’s picture

Priority: Normal » Critical

I am seeing the same error as mentioned in #8. As @rajdip_755 says in his comment, the fix for that problem (i.e., changing the dispatch() method's argument order, as mentioned in #9) is already in the 4.0.x branch (see https://git.drupalcode.org/project/forward/-/commit/322887d1df607c30fa2b...), so I think all that needs to be done is roll a new release that includes the fix. Raising this to critical as this prevents the module from functioning currently.

b-prod’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new5.65 KB

Here is a temporary patch for the 4.0.2 release, which fixes several issues on the form, not only the one with event dispatcher. So people can try to use this module with current release.

The module contains a lot of weird errors and do not seem to have been correctly tested. Even the Drupal services used in the form are not passed with the expected interfaces, sometimes the defined type for a parameter does not have any sense.

The main question is: is this module still maintained? If not, it should be specified in the main project page.

I set this issue as "Reviewed", hoping this could awake the maintainers, so they create a new release, as asked by @brunodbo 8 month ago.

dww’s picture

Right. This is already (mostly) fixed via #3355406: EventDispatcher::dispatch() argument order changed 9.1. So this issue is sort of duplicate. But yeah, there hasn't been a new release, so it's still a fatal error trying to use 4.0.2 with D10.

I volunteered at #3579000: Make @dww a co-maintainer for Forward module. Hopefully that happens. If so, I'll get this sorted out and released ASAP.

Thanks,
-Derek

  • dww committed f55d8253 on 4.0.x
    fix: #3443323 TypeError $event_dispatcher must be of type...
dww’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, everyone!

I manually merged the remaining fixes from patch #11 into the MR. Rebased that against 4.0.x. Verified the pipelines are still green on both D10 and D9. Merged to 4.0.x.

I'll be shipping a 4.0.3 release very soon. Just cleaning up a few more things before I do.

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.

Status: Fixed » Closed (fixed)

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