It looks like the event subscriber causes a fatal error when the splash page is enabled and I try to revert a node revision.
To reproduce:
– Enable the Splash Redirect module.
– Add a redirect and enable it.
– Edit a node that has revisions.
– Try to revert a revision. It fails, with the following error in the report log:
Error: Call to a member function id() on string in Drupal\splash_redirect\EventSubscriber\SplashRedirectEventSubscriber->onKernelRequest() (line 85 of /srv/bindings/a412afed659a45b2821f26a22622e79e/code/modules/contrib/splash_redirect/src/EventSubscriber/SplashRedirectEventSubscriber.php)
85 is the second line in this snippet:
$route = ($this->currentRouteMatch->getParameter('node')) ?
'/node/' . $this->currentRouteMatch->getParameter('node')->id() :
$this->currentRouteMatch->getRouteObject()->getPath();
Any help on how to patch this would be appreciated!
Comments
Comment #2
adambernstein commentedThanks for the clear and concise bug report, I will look into this as soon as I can.
Comment #3
adambernstein commentedComment #4
adambernstein commentedHere's what I've learned: this is an issue with 'revision' routes and it is a common issue for Drupal. There is an issue in the Drupal Core queue about this and it appears to be in review for the Drupal 8.8.x release. So given that this issue may soon be fixed in core, it may be better to apply this patch in the meantime while we wait for Core to be updated.
The patch adds a RouteSubscriber service to listen for revisions paths and will extract the node ID accordingly. Let me know how it works for you.
Comment #5
kurttrowbridgeWow, thanks for the quick turnaround. I applied the patch on a test site and it looks like I can successfully revert revisions now!
Comment #6
adambernstein commentedGood to hear it's working for you! Thanks for submitting the bug.
Comment #8
grabby commentedI don’t see that #4 made it to 8.x-1.8. I was getting
The website encountered an unexpected error. Please try again later.
Error: Call to a member function id() on string in Drupal\splash_redirect\EventSubscriber\SplashRedirectEventSubscriber->onKernelRequest() (line 85 of modules\contrib\splash_redirect\src\EventSubscriber\SplashRedirectEventSubscriber.php).
Drupal\splash_redirect\EventSubscriber\SplashRedirectEventSubscriber->onKernelRequest(Object, 'kernel.request', Object)
call_user_func(Array, Object, 'kernel.request', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 134)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
before applying it to 1.8 and got the same thing afterwards. I’m attaching the patched module just to allow it to be checked.