Problem/Motivation

Drupal core 10.4

TypeError: Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch(): Argument #1 ($event) must be of type object, string given, called in /var/www/html/drupal/modules/contrib/commerce_vipps/src/PluginForm/OffsiteRedirect/VippsLandingPageRedirectForm.php on line 131 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 89 of core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php).

Steps to reproduce

Initiate payment with Vipps

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

oleksandr yushchenko created an issue. See original summary.

oleksandr yushchenko’s picture

Issue summary: View changes

eiriksm’s picture

Status: Active » Reviewed & tested by the community

This looks good to me.

The only thing is we are per the info file still compatible with Drupal 9.x here. Is it allowed to pass them in that order on Drupal 9? Just asking since I don't have it in front of me, and I think it is?

oleksandr yushchenko’s picture

Yes.
D9:

/**
   * {@inheritdoc}
   */
  public function dispatch($event/*, string $event_name = NULL*/) {
    $event_name = 1 < \func_num_args() ? func_get_arg(1) : NULL;

D10:

/**
   * {@inheritdoc}
   */
  public function dispatch(object $event, ?string $eventName = NULL): object {
    $event_name = $eventName ?? get_class($event);

oleksandr yushchenko’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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