Skip to content

Commit

Permalink
[BUGFIX] Catch PHP8 array key warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Schreiber authored and andreaskienast committed Nov 22, 2022
1 parent 75d1283 commit 56fb360
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Classes/ExpressionLanguage/BlogVariableProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class BlogVariableProvider
public function isPost(): bool
{
$page = $GLOBALS['TSFE']->page ?? [];
return $page['doktype'] == Constants::DOKTYPE_BLOG_POST;
if (isset($page['doktype'])) {
return $page['doktype'] == Constants::DOKTYPE_BLOG_POST;
}
return false;
}

/**
Expand All @@ -32,6 +35,9 @@ public function isPost(): bool
public function isPage(): bool
{
$page = $GLOBALS['TSFE']->page ?? [];
return $page['doktype'] == Constants::DOKTYPE_BLOG_PAGE;
if (isset($page['doktype'])) {
return $page['doktype'] == Constants::DOKTYPE_BLOG_PAGE;
}
return false;
}
}

0 comments on commit 56fb360

Please sign in to comment.