Skip to content

Commit

Permalink
[BUGFIX] Prevent undefined array key warning within LinkingSuggestion…
Browse files Browse the repository at this point in the history
…sService
  • Loading branch information
Riny van Tiggelen committed Dec 11, 2023
1 parent 9c6ee26 commit c105d6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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
6 changes: 3 additions & 3 deletions Classes/Service/LinkingSuggestionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ protected function groupWordsByRecord(array $candidateWords): array
{
$candidateWordsByRecords = [];
foreach ($candidateWords as $candidateWord) {
$recordKey = $candidateWord['uid_foreign'] . '-' . $candidateWord['tablenames'];
if (!array_key_exists('weight', $candidateWord) || !array_key_exists('df', $candidateWord)) {
if (!isset($candidateWord['weight'], $candidateWord['df'])) {
continue;
}
$recordKey = $candidateWord['uid_foreign'] . '-' . $candidateWord['tablenames'];
$candidateWordsByRecords[$recordKey][$candidateWord['stem']] = [
'weight' => (int)$candidateWord['weight'],
'df' => (int)$candidateWord['df']
Expand Down Expand Up @@ -348,7 +348,7 @@ protected function linkRecords(array $scores, array $currentLinks): array
'recordType' => $this->getRecordType($table),
'id' => $uid,
'table' => $table,
'cornerstone' => array_key_exists('tx_yoastseo_cornerstone', $data) ? (int)$data['tx_yoastseo_cornerstone'] : 0,
'cornerstone' => (int)($data['tx_yoastseo_cornerstone'] ?? 0),
'score' => $score,
'active' => isset($currentLinks[$record])
];
Expand Down

0 comments on commit c105d6d

Please sign in to comment.