Drupal 8.1 recently switched to Composer 2.8 in #2611816: Update to symfony 2.8. In Symfony 2.8 the method getListenerPriority() is called on event dispatchers, but the web profiler doesn't implement this, resulting in the following fatal error when the module is enabled:

Error: Call to undefined method Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::getListenerPriority() in vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php on line 107

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen created an issue. See original summary.

pfrenssen’s picture

Status: Active » Needs review
FileSize
482 bytes

I'm not sure where to get the listener priority from, even though this method is called it is not included in the TraceableEventDispatcherInterface and because of this the documentation on how to use this is missing. This at least allows to enable the module again, and since we didn't report back a priority before this also doesn't regress anything.

lussoluca’s picture

IMHO that method needs to be added to Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher, because in Symfony 3.0 it will be added to the EventDispatcherInterface:

https://github.com/symfony/symfony/pull/16301

pfrenssen’s picture

The bug that getListenerPriority() is missing from the interface is fixed in Symfony 3.0: Issue 16301: [EventDispatcher] add method getListenerPriority() to interface. I'm not sure what the policy on backporting is for the Symfony project though.

Kgaut’s picture

I can confirm that the patch #2 clear this issue.

pfrenssen’s picture

@lussoluca, cross-posted :)

That looks indeed to be the case. I'll open an issue to address this. If I look at how Symfony deals with this, then it seems we will still need it here too. From \Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher:

    /**
     * {@inheritdoc}
     */
    public function getListenerPriority($eventName, $listener)
    {
        $this->lazyLoad($eventName);

        return parent::getListenerPriority($eventName, $listener);
    }
pfrenssen’s picture

Ok from comment #42 on the symfony 2.8 update issue #2611816-42: Update to symfony 2.8 it appears that core's implementation of ContainerAwareEventDispatcher has consciously omitted the implementation of ::getListenerPriority():

+    public function testGetListenerPriority()
+    {
+        // Override the parent test as our implementation doesn't provider
+        // getListenerPriority().
+    }
pfrenssen’s picture

lussoluca’s picture

  • lussoluca authored a384b8d on 8.x-1.x
    Issue #2682343 by pfrenssen, lussoluca: Fatal error enabling web...
lussoluca’s picture

Status: Needs review » Closed (fixed)

Committed and pushed to 8.x-1.x.

dianacastillo’s picture

When will this be merged into a non - dev release? thanks

Andre-B’s picture

This needs to be ported to 2.x as well.

lussoluca’s picture

Status: Closed (fixed) » Needs review
Issue tags: +DevDaysSeville
FileSize
710 bytes

In the latest version of Drupal core this is no longer required, so we can remove it.

lussoluca’s picture

Status: Needs review » Fixed

TraceableEventDispatcher has been heavily modified since then and this is no longer applicable/needed.

Status: Fixed » Closed (fixed)

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