Skip to content

Commit

Permalink
[BUGFIX] Prevent exception in AccessComponent
Browse files Browse the repository at this point in the history
AccessComponent expects to find the TypoScriptFrontendController in
$GLOBALS['TSFE'], and will cause an exception in CLI context.

To prevent this an additional check for TSFE in AccessComponent is
added, similiar to other components like LastSearchesComponent.

Relates: #3675
Resolves: #3944
  • Loading branch information
dkd-friedrich committed Feb 6, 2024
1 parent 119f557 commit 5e78ce8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Classes/Search/AccessComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public function __construct(
*/
public function __invoke(AfterSearchQueryHasBeenPreparedEvent $event): void
{
if (!isset($GLOBALS['TSFE'])) {
return;
}

$query = $this->queryBuilder
->startFrom($event->getQuery())
->useSiteHashFromTypoScript($GLOBALS['TSFE']->id)
Expand Down

0 comments on commit 5e78ce8

Please sign in to comment.