Skip to content

Commit

Permalink
Fix SiteAccess mapping on inline legacy calls with default site access (
Browse files Browse the repository at this point in the history
ezsystems#157)

* [Travis] Add 1.4 to active branches

* Fix unit tests

* Fix SiteAccess mapping on inline legacy calls with default site access
  • Loading branch information
andrerom committed Aug 10, 2018
1 parent f1a54f9 commit afa769f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bundle/LegacyMapper/SiteAccess.php
Expand Up @@ -87,8 +87,9 @@ public function onBuildKernelWebHandler(PreBuildKernelWebHandlerEvent $event)
} else {
$semanticPathinfo = $request->attributes->get('semanticPathinfo', $pathinfo);
}

$pos = mb_strrpos($pathinfo, $semanticPathinfo);
if ($pathinfo != $semanticPathinfo && $pos !== false) {
if ($legacyAccessType !== eZSiteAccess::TYPE_DEFAULT && $pathinfo != $semanticPathinfo && $pos !== false) {
if ($pos === 0) {
$pos = mb_strlen($pathinfo) + 1;
}
Expand Down
11 changes: 11 additions & 0 deletions bundle/Tests/SiteAccess/LegacyMapperTest.php
Expand Up @@ -99,6 +99,7 @@ public function testOnSiteAccessMatchUriPart($pathinfo, $semanticPathinfo, $view

public function siteAccessMatchProvider()
{
// args: $pathinfo, $semanticPathinfo, $siteaccess, $expectedAccess
return array(
array(
'/some/pathinfo',
Expand Down Expand Up @@ -300,6 +301,16 @@ public function siteAccessMatchProvider()
'uri_part' => array(),
),
),
array(
'/_fragment',
'/',
new SiteAccess('site', 'default'),
array(
'name' => 'site',
'type' => 1,
'uri_part' => array(),
),
),
);
}

Expand Down

0 comments on commit afa769f

Please sign in to comment.