Skip to content

Commit

Permalink
IBX-6207: Requests containing front controller script causes session-…
Browse files Browse the repository at this point in the history
…not-found exception (#377)
  • Loading branch information
vidarl authored Nov 3, 2023
1 parent 8880cf8 commit 0f4d6ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ public static function getSubscribedEvents()
public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
{
$request = $event->getRequest();
$session = $request->getSession();
$session = null;
if ($request->hasSession()) {
$session = $request->getSession();
}

if (!$session || $event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) {
if (null === $session || $event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,12 @@ public function testOnSiteAccessMatchNewSessionName()

$this->listener->onSiteAccessMatch($event);
}

public function testOnSiteAccessMatchNoSession(): void
{
$request = new Request();

$event = new PostSiteAccessMatchEvent(new SiteAccess('test'), $request, HttpKernelInterface::MAIN_REQUEST);
$this->listener->onSiteAccessMatch($event);
}
}

0 comments on commit 0f4d6ab

Please sign in to comment.