When we updated to Symfony 2.8 in #2611816: Update to symfony 2.8 we didn't implement the getListenerPriority() method on ContainerAwareEventDispatcher, probably because it was not required on the interface.
Unfortunately the omission of this method on the interface is a bug in Symfony, since the method is being actively used. This has been fixed in Symfony 3.0 in Issue #16301: [EventDispatcher] add method getListenerPriority() to interface but it is not clear if this will be backported to 2.8.
Marking this as a bug since it is already breaking contrib (e.g. #2682343: Fatal error enabling web profiler on 8.1.x). We'll have to implement this anyway before Drupal 8.2.x which will depend on Symfony 3.0, but it would be good to have this in earlier.
Comment | File | Size | Author |
---|---|---|---|
#16 | event-dispatcher-2682373-16.patch | 3.05 KB | klausi |
Comments
Comment #2
thePanz CreditAttribution: thePanz as a volunteer commentedPatch attached implementing the missing method.
The two lines
have been removed since those calls are deprecated since Symfony 2.4 (and will be removed in Symfony 3.x)
Comment #3
thePanz CreditAttribution: thePanz as a volunteer commentedAdded missing patch.
Comment #4
thePanz CreditAttribution: thePanz as a volunteer commentedComment #6
hswong3i CreditAttribution: hswong3i commentedConfirm that it also break CLI usage with drush-8.1.0. I am now temporary apply this patch for https://www.drupal.org/project/drustack
Comment #7
BerdirConfirmed that this fixes the problem that I had with webprofiler enabled.
However, not sure about the removal of the deprecated calls. That's unrelated and might be causing those test fails. We can deal with that when updating to 3.0, if we actually do that.
Comment #8
thePanz CreditAttribution: thePanz as a volunteer commentedPatch updated against latest 8.1.x branch, the deprecated calls have been restored as @berdir suggested.
Let's see if TestBot is happy again :)
Comment #9
dawehnerSure, why not.
It would be nice if we could expand the test coverage, I guess there is some existing test code in symfony we could just copy?
Comment #10
klausiFixed link.
Comment #11
klausiTest coverage is an excellent idea as it turns out that the implementation is broken.
Fixed that plus:
1) Enabled testGetListenerPriority() from Symfony.
2) Added testGetListenerPriorityWithServices() because we do this lazy service instantiation thing in our event dispatcher, which needs to work in every method.
Comment #12
klausiMaking Symfony 3 update the parent issue of this.
Comment #13
jibranLooks good to me. Thanks @klausi.
Comment #14
catchNo yoda conditions please.
Extra blank line.
Needs a comment as to why we're setting the callable as well as returning the priority. The interface docs mention nothing about this for example.
Comment #15
klausiYoda conditions: this is code copied from Symfony, so we should add a comment: "// Code copied from Symfony, that's why we use yoda conditions here."
The blank line between functions should there, it is just the diff that looks weird.
Setting the callable: this is the lazy loading our Drupal specific implementation does. For the comparison we need the callable, and for subsequent calls we cache it on the object, as we do in the other methods of this class. Comment should be "// Cache the callable here to have it read on subsequent invocations."
Comment #16
klausiAdded those comments.
Comment #17
jibranOk. Let's see what @catch thinks about it now.
Comment #19
jibranRandom fail.
Comment #21
klausiThe usual random migrate module fail, back to RTBC.
Comment #23
catchNot convinced about copying the yoda condition from Symfony, feels like a slippery slope. But easy to reverse in a minor coding standards issue another time and the parent issue is very important.
That's not between a function, but fixed on commit.