- Issue created by @adrianopulz
- Assigned to Shreya_98
- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 5:30am 26 October 2023 - ๐ฎ๐ณIndia Shreya_98
Hi @adrianopulz,
I have fixed this issue and also created MR for this issue . please replace The 'internal:/' URL is a reference to the internal path '/', which typically represents the homepage of your Drupal site. In other words, it's setting the fallback URL to the site's homepage.Thank you!
- ๐ง๐ทBrazil adrianopulz Florianรณpolis
Thanks for your fork @shreya_th!
The problem is for URLs created from the Request, URLs from the route will not be a problem. You added try/catch to the URL created from the route when the display['display_options']['path'] is set. We need the fallback only in the createFromRequest() call.
I've added a patch with the change example. I don't think we need to change the block of code using the UrlFromRoute.
- Status changed to Needs work
7 months ago 7:59pm 10 April 2024 - Status changed to Postponed: needs info
7 months ago 12:48pm 22 April 2024 - ๐บ๐ธUnited States smustgrave
That snippet of code has been removed in another fix. Can you confirm this is still an issue.
- Status changed to Closed: outdated
6 months ago 3:07pm 22 May 2024 - Status changed to Needs work
5 months ago 10:57am 3 July 2024 - ๐ณ๐ฑNetherlands Johan den Hollander
Hate to be reopening this issue, but the issue is still there using the latest 7.x release.
We worked around the issue for now by modifying the code to be as follows:
use Symfony\Component\Routing\Exception\ResourceNotFoundException; protected function getExposedFormActionUrl(FormStateInterface $form_state): Url { $request = \Drupal::request(); try { $url = Url::createFromRequest(clone $request); $url->setAbsolute(); return $url; } catch (ResourceNotFoundException $e) { return Url::fromRoute('<front>')->setAbsolute(); } }
A patch will follow, I expect this code needs some better attention.
- ๐จ๐พCyprus alex.bukach
Alex Bukach โ made their first commit to this issueโs fork.
- Status changed to Needs review
5 months ago 6:31pm 3 July 2024 - Status changed to Needs work
4 months ago 1:02am 4 July 2024 - ๐บ๐ธUnited States smustgrave
MR should be against 7.0.x but letโs add test coverage also
- Status changed to Postponed: needs info
3 months ago 12:02am 29 August 2024 - ๐บ๐ธUnited States smustgrave
Could the steps be flushed out.
I added a view block that's used better exposed filters to 404 page and not getting any error.
On 10.3
- ๐จ๐ญSwitzerland idflood
I've got the same issue. I've defined a global "search" exposed form in block, which is added to the header of the website. Then on all 404 pages it shows the same error.
I've tried the patch in #12 and it went nicely, even if I'm still using the 6.x version. The patch fixed the issue, at least there is now no more errors.
- ๐บ๐ธUnited States smustgrave
Still needs step to reproduce fully or going to close out
- ๐ฌ๐งUnited Kingdom malcomio
We started seeing this issue recently with better_exposed_filters 6.0.6 after upgrading core
As with #15, we have an exposed search form in the header block which shows on all pages.
From our tests so far, the patch in #12 seems to fix the issue, but we will test further.
I've updated the steps to reproduce.
- ๐บ๐ธUnited States smustgrave
Letโs open an MR for 7.0.x and add a simple test case
- ๐ฌ๐งUnited Kingdom malcomio
Having tested further, it seems like the patch fixes the problem for logged-in users, but not anonymous.
- ๐ฌ๐งUnited Kingdom malcomio
With this patch included, we observed a strange issue where BEF checkboxes showed 0 instead of the expected markup.
- ๐ฌ๐งUnited Kingdom malcomio
In our case, this seems to relate to facets, as mentioned in #20
The mention of better_exposed_filters in the stack trace isn't the root of the problem for us.
When a facets block appears on a 404 page, it causes problems with URL generation.
I think that the appropriate fix relates to one of these issues:
#3291943: When rendering facets on non search page, it throws error instead of 404 on 404 pages โ
๐ ResourceNotFoundException with ajax facets when site running in subfolder Needs reviewIn
\Drupal\facets\Plugin\Block\FacetBlock::build
, if we add a condition to stop the block rendering on 404 pages, the problem goes away.@idflood, @alex.bucach, @adrianopulaz, @johan den hollander - do the stack traces you see also mention facets?
- ๐ฌ๐งUnited Kingdom malcomio
Even with our patch to facets in place, we encountered this error again, although in a slightly odd scenario that came up via a penetration test, with some special characters in the URL.
Our search results page is at /search-content - the security scanner managed to trigger this exception at /search-content%22%3bexpr%20268409241%20-%2028291%3b%22?search= (and some other similar URLs).
When we apply the patch in #12, it addresses the issue.
The error mentioned in #21 seems to have been happening because we were using an incorrect patch for ๐ Links with "Show hierarchy in dropdown" disabled gives "Deprecated function: range(): Passing null to parameter #1" Active