The RequestPath condition plugin throws this exception when https://www.example.com// is requested. i.e. with a double slash instead of a single one. The error happens in this code block:
$path = $this->currentPath->getPath($request);
// Do not trim a trailing slash if that is the complete path.
$path = $path === '/' ? $path : rtrim($path, '/');
$path_alias = mb_strtolower($this->aliasManager->getAliasByPath($path));
If the requested path is "//", then the rtrim gets applied, resulting in an empty string.
Proposing the solution to remove double slashes generally in the path before any further evaluation, as a double slash can always only be by mistake. Going to provide an MR shortly.
Comments
Comment #3
jurgenhaasComment #4
cilefen commentedComment #7
jurgenhaasUpdated the MR to also cover weird cases with more than two slashes, e.g. if
https://www.example.com///gets requested.Comment #9
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.
Change looks good
Tagging for tests as needed with bugs.
The MR will need to be updated for 9.5.x or a new one for 10.1.x
Comment #12
rpayanmI rerolled the patch for the 10.1.x branch
Comment #14
dieterholvoet commentedThis
InvalidArgumentExceptionis also being triggered by bot traffic on all our sites using the Lazy module because it uses thisRequestPathcondition plugin. It's being triggered by visiting the path/index.php.suspected, so not just paths with double slashes. That's why I want to propose to also just catch anyInvalidArgumentExceptions thrown in thegetAliasByPath()method.