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)
Comments
Comment #2
Praveen rani commentedComment #4
Praveen rani commentedTo resolve the above issue, I have created MR. Please review changes.
Comment #5
john.oltman commentedThanks 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
Comment #7
atul_ghate commentedI have added the MR as per suggestion #5. Please review.
Comment #8
rajdip_755Hi everyone!
I'm trying to review the MR 4 but I'm unable to reproduce the same issue mentioned in the description.
It will be helpful if someone please mention the steps to reproduce for the issue mentioned in the description.
Thanks in advance!
Comment #9
john.oltman commentedThe 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.
Comment #10
brunodboI 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.Comment #11
b-prod commentedHere 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.
Comment #12
dwwRight. 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
Comment #14
dwwThanks, 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.