Skip to content

Commit

Permalink
Fix PHP 8 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mroi authored and leofeyer committed Mar 24, 2021
1 parent a8c6765 commit d5819bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Expand Up @@ -170,7 +170,7 @@ protected function doReplace($strBuffer, $blnCache)

// Accessibility tags
case 'lang':
if (!$elements[1])
if (empty($elements[1]))
{
$arrCache[$strTag] = '</span>';
}
Expand All @@ -189,7 +189,7 @@ protected function doReplace($strBuffer, $blnCache)
case 'email':
case 'email_open':
case 'email_url':
if (!$elements[1])
if (empty($elements[1]))
{
$arrCache[$strTag] = '';
break;
Expand Down Expand Up @@ -742,7 +742,7 @@ protected function doReplace($strBuffer, $blnCache)
case 'ua':
$ua = Environment::get('agent');

if ($elements[1])
if (!empty($elements[1]))
{
$arrCache[$strTag] = $ua->{$elements[1]};
}
Expand All @@ -755,7 +755,7 @@ protected function doReplace($strBuffer, $blnCache)
// Abbreviations
case 'abbr':
case 'acronym':
if ($elements[1])
if (!empty($elements[1]))
{
$arrCache[$strTag] = '<abbr title="' . StringUtil::specialchars($elements[1]) . '">';
}
Expand Down
4 changes: 3 additions & 1 deletion core-bundle/src/Resources/contao/library/Contao/Search.php
Expand Up @@ -154,10 +154,12 @@ public static function indexPage($arrData)
$arrData['description'] = trim(preg_replace('/ +/', ' ', StringUtil::decodeEntities($tags[1])));
}

$arrData['keywords'] = '';

// Get the keywords
if (preg_match('/<meta[^>]+name="keywords"[^>]+content="([^"]*)"[^>]*>/i', $strHead, $tags))
{
$arrData['keywords'] = trim(preg_replace('/ +/', ' ', StringUtil::decodeEntities($tags[1])));
$arrData['keywords'] .= trim(preg_replace('/ +/', ' ', StringUtil::decodeEntities($tags[1])));
}

// Read the title and alt attributes
Expand Down
4 changes: 2 additions & 2 deletions news-bundle/src/Resources/contao/modules/ModuleNews.php
Expand Up @@ -148,12 +148,12 @@ protected function parseArticle($objArticle, $blnAddArchive=false, $strClass='',
$arrMeta = $this->getMetaFields($objArticle);

// Add the meta information
$objTemplate->date = $arrMeta['date'];
$objTemplate->date = $arrMeta['date'] ?? null;
$objTemplate->hasMetaFields = !empty($arrMeta);
$objTemplate->numberOfComments = $arrMeta['ccount'] ?? null;
$objTemplate->commentCount = $arrMeta['comments'] ?? null;
$objTemplate->timestamp = $objArticle->date;
$objTemplate->author = $arrMeta['author'];
$objTemplate->author = $arrMeta['author'] ?? null;
$objTemplate->datetime = date('Y-m-d\TH:i:sP', $objArticle->date);
$objTemplate->addImage = false;
$objTemplate->addBefore = false;
Expand Down

0 comments on commit d5819bb

Please sign in to comment.