Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Commit

Permalink
fixed bug when dimension prefix is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
breadlesscode committed Jan 9, 2018
1 parent 94a9dd2 commit 9720efb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/PageViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function findErrorPage($requestPath, $statusCode)
->filter(function ($page) use ($dimension) {
return \in_array($dimension, $page->getDimensions()['language']);
})
// filter all pages which not in the correct path
// sort by distance
->sortBy(function ($page) use ($requestPath, $dimension) {
return PathUtility::compare(
$this->getPathWithoutDimensionPrefix($requestPath),
Expand All @@ -101,7 +101,7 @@ protected function getPathWithoutDimensionPrefix($path)
$matches = [];
preg_match(FrontendNodeRoutePartHandler::DIMENSION_REQUEST_PATH_MATCHER, ltrim($path, '/'), $matches);

if ($presets->pluck('uriSegment')->contains($matches['firstUriPart'])) {
if (isset($matches['firstUriPart']) && $presets->pluck('uriSegment')->contains($matches['firstUriPart'])) {
return substr(ltrim($path, '/'), strlen($matches['firstUriPart']));
}

Expand Down

0 comments on commit 9720efb

Please sign in to comment.