The onView, onHtml, onJson etc methods of the ViewSubscriber class all take a GetResponseEvent object as their only parameter, on which most proceed to call the getControllerResult() method. However, the GetResponseEvent class does not have such a method. What actually gets passed is a GetResponseForControllerResultEvent object so I'm pretty sure that's what ought to be in the method signature.
Patch forthcoming...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

katbailey’s picture

Status: Active » Needs review
FileSize
2.9 KB
Niklas Fiekas’s picture

Priority: Minor » Normal
Status: Needs review » Reviewed & tested by the community

Yep, good catch, thanks! I'd also say this isn't really minor, but rather misleading enough for normal ;)

chx’s picture

Status: Reviewed & tested by the community » Needs review

Hrm, how can tests pass then? Oh, I see class GetResponseForControllerResultEvent extends GetResponseEvent so the signature didn't cause an immediate fatal. Do we need tests for this?

Niklas Fiekas’s picture

Well ... it is barely possible to test this then, no?

katbailey’s picture

I don't see how we could write a test for this - the onView method will always get a GetResponseForControllerResultEvent passed in because it's subscribed to the kernel.view event and that's the class of event that gets thrown. So calling the getControllerResult() method on the object will never cause a problem.
It's just that the signature is wrong.

chx’s picture

Status: Needs review » Reviewed & tested by the community

OK then.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Good catch. Committed to 8.x.

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