Skip to content

Commit

Permalink
[BUGFIX] Fix PHP warnings on undefined array keys
Browse files Browse the repository at this point in the history
  • Loading branch information
davkraid committed Jan 26, 2023
1 parent b897441 commit 776a781
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Classes/Middleware/LanguageRedirectMiddleware.php
Expand Up @@ -30,7 +30,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
{
$typoScript = $this->getTypoScriptSetup();

if ((int)$typoScript['config.']['tx_locate'] === 1 && !empty($typoScript['config.']['tx_locate.'] ?? [])) {
if (isset($typoScript['config.']) && isset($typoScript['config.']['tx_locate']) && (int)$typoScript['config.']['tx_locate'] === 1) {
$locateSetup = $typoScript['config.']['tx_locate.'];

$config = [
Expand Down
2 changes: 1 addition & 1 deletion Classes/Middleware/PageUnavailableMiddleware.php
Expand Up @@ -36,7 +36,7 @@ class PageUnavailableMiddleware implements MiddlewareInterface
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Not responsible if backend user is logged in or EXT:static_info_tables is not loaded.
if (($GLOBALS['BE_USER']->user !== null && $GLOBALS['BE_USER']->user['uid'] > 0) || ExtensionManagementUtility::isLoaded('static_info_tables') === false) {
if (($GLOBALS['BE_USER'] !== null && $GLOBALS['BE_USER']->user !== null && $GLOBALS['BE_USER']->user['uid'] > 0) || ExtensionManagementUtility::isLoaded('static_info_tables') === false) {
return $handler->handle($request);
}

Expand Down
2 changes: 1 addition & 1 deletion Classes/Processor/Court.php
Expand Up @@ -153,7 +153,7 @@ protected function callJudges(): ?Decision

protected function addJudgement(array &$judgements, array $configuration, $key, AbstractJudge $judge, array &$priorities): void
{
$fact = $this->facts[$configuration['fact']] ?? new StaticFactProvider();
$fact = (isset($configuration['fact']) && isset($this->facts[$configuration['fact']])) ? $this->facts[$configuration['fact']] : new StaticFactProvider();

if ($fact instanceof AbstractFactProvider) {
$judge = $judge->withConfiguration($this->configuration['judges'][$key . '.'])->adjudicate($fact, (int)$key);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Verdict/Redirect.php
Expand Up @@ -55,7 +55,7 @@ public function execute(): ?ResponseInterface
}

// Try to redirect to page (if not set, it will be the current page) on configured language
if ($this->configuration['page'] || isset($this->configuration['sys_language'])) {
if ((isset($this->configuration['page']) && !empty($this->configuration['page'])) || isset($this->configuration['sys_language'])) {
$this->logger->info('Try to redirect to page');

return $this->redirectToPage();
Expand Down

0 comments on commit 776a781

Please sign in to comment.