This problem is critial, the module breaks important Drupal behaviour!
Problem:
Non existing routes lead to a ResourceNotFoundException instead of a clean 404 when this module is installed .
Auf der Website ist ein unvorhergesehener Fehler aufgetreten. Bitte versuchen Sie es später nochmal.Symfony\Component\Routing\Exception\ResourceNotFoundException: No routes found for "/nonExistingExamplePage". in Drupal\Core\Routing\Router->matchRequest() (line 125 of core/lib/Drupal/Core/Routing/Router.php).
Drupal\administration_language_negotiation\Plugin\AdministrationLanguageNegotiationCondition\AdminRoutes->isAdminRoute() (Line: 113) Drupal\administration_language_negotiation\Plugin\AdministrationLanguageNegotiationCondition\AdminRoutes->evaluate() (Line: 80) Drupal\administration_language_negotiation\AdministrationLanguageNegotiationConditionManager->execute(Object) (Line: 86) Drupal\administration_language_negotiation\Plugin\LanguageNegotiation\LanguageNegotiationAdministrationLanguage->getLangcode(Object) (Line: 186) Drupal\language\LanguageNegotiator->negotiateLanguage('language_interface', 'administration-language-negotiation') (Line: 131) Drupal\language\LanguageNegotiator->initializeType('language_interface') (Line: 218) Drupal\language\ConfigurableLanguageManager->getCurrentLanguage() (Line: 93) Drupal\language\EventSubscriber\LanguageRequestSubscriber->setLanguageOverrides() (Line: 75) Drupal\language\EventSubscriber\LanguageRequestSubscriber->onKernelRequestLanguage(Object, 'kernel.request', Object) call_user_func(Array, Object, 'kernel.request', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object) (Line: 127) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50) Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Reproduction:
- Install this module
- Activate Administration language (/admin/config/regional/language/detection)
- Select URL as further handler (/admin/config/regional/language/detection) - I used /de and /en in my test
- Enable "Admin Routes" (/admin/config/regional/language/detection/administration_language)
- Call any non existing URL... e.g. /thispagedoesntexist
- Boom!
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff_8-10.txt | 5.01 KB | beram |
| #10 | 2983798_ResourceNotFoundException_10.patch | 6.19 KB | beram |
| #8 | 2983798_ResourceNotFoundException_8.patch | 2.78 KB | richardcanoe |
| #6 | 2983798_ResourceNotFoundException_6.patch | 1.17 KB | richardcanoe |
Comments
Comment #2
anybodyComment #3
anybodyComment #4
richardcanoe commentedThis should work :-)
Comment #5
richardcanoe commentedComment #6
richardcanoe commentedComment #7
anybodyNope!
Comment #8
richardcanoe commentedMissing use case added.
Comment #9
richardcanoe commentedComment #10
beram commentedHi,
The patch from comment #8 seems to work.
Nevertheless I modified it in order to:
router.admin_contextprovided by Core which contains aisAdminRoute()method rather than doing what it already does. I also added a comment to explain why just using this method is not enough.config.factoryandlanguage_managerwere instantiated but never usedAdminRoutesconstructor was wrong. It does notConstructs a RequestPath condition plugin.and parameters were missingcatchwas breaking the phpcs configuration setup on this project. (I'd like one day to see this project adopting Drupal coding standard)IMHO we also need to setup some tests to avoid regression in the future.
You'll also find the interdiff.
Regards,
Comment #12
polVery nice patch, thanks !!!