Skip to content

Commit

Permalink
Merge pull request #566 from peterkraume/main
Browse files Browse the repository at this point in the history
[BUGFIX] Prevent undefined array key warning
  • Loading branch information
RinyVT authored Dec 18, 2023
2 parents 77b5100 + c105d6d commit 200fd73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ We will follow [Semantic Versioning](http://semver.org/).

## UNRELEASED
### Fixed
- Prevent undefined array key warning within `LinkingSuggestionsService`
- Missing label of the tx_yoastseo_prominent_word table
- Removed exclude=true from tx_yoastseo_prominent_word fields, table already has hideTable
- Use `websiteTitle` of site configuration within snippet preview, previously this was only taken from site languages instead of the site itself
Expand Down
5 changes: 4 additions & 1 deletion Classes/Service/LinkingSuggestionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ protected function groupWordsByRecord(array $candidateWords): array
{
$candidateWordsByRecords = [];
foreach ($candidateWords as $candidateWord) {
if (!isset($candidateWord['weight'], $candidateWord['df'])) {
continue;
}
$recordKey = $candidateWord['uid_foreign'] . '-' . $candidateWord['tablenames'];
$candidateWordsByRecords[$recordKey][$candidateWord['stem']] = [
'weight' => (int)$candidateWord['weight'],
Expand Down Expand Up @@ -345,7 +348,7 @@ protected function linkRecords(array $scores, array $currentLinks): array
'recordType' => $this->getRecordType($table),
'id' => $uid,
'table' => $table,
'cornerstone' => (int)$data['tx_yoastseo_cornerstone'],
'cornerstone' => (int)($data['tx_yoastseo_cornerstone'] ?? 0),
'score' => $score,
'active' => isset($currentLinks[$record])
];
Expand Down

0 comments on commit 200fd73

Please sign in to comment.