Skip to content

Commit

Permalink
[BUGFIX] Fix undefined array key in linkvalidator module
Browse files Browse the repository at this point in the history
Resolves: #95430
Releases: master
Change-Id: Ie55e52fb972c5f6a3bf44b321999c9098242bc68
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71401
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
  • Loading branch information
o-ba authored and bnf committed Oct 1, 2021
1 parent cc192c7 commit 9f6f615
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -205,7 +205,7 @@ protected function setTypoLinkPartsElement($tLP, &$elements, $content, $idx)
];
// Output content will be the token instead:
$content = '{softref:' . $tokenID . '}';
} elseif ($tLP['identifier']) {
} elseif ($tLP['identifier'] ?? false) {
$linkHandlerValue = explode(':', trim($tLP['identifier']), 2)[1];
if (MathUtility::canBeInterpretedAsInteger($linkHandlerValue)) {
// Token and substitute value
Expand Down
18 changes: 9 additions & 9 deletions typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
Expand Up @@ -357,26 +357,26 @@ public function analyzeRecord(array &$results, $table, array $fields, array $rec
protected function analyzeLinks(SoftReferenceParserResult $parserResult, array &$results, array $record, $field, $table)
{
foreach ($parserResult->getMatchedElements() as $element) {
$r = $element['subst'];
$reference = $element['subst'] ?? [];
$type = '';
$idRecord = $record['uid'];
if (empty($r)) {
if (empty($reference)) {
continue;
}

foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
$type = $hookObj->fetchType($r, $type, $keyArr);
$type = $hookObj->fetchType($reference, $type, $keyArr);
// Store the type that was found
// This prevents overriding by internal validator
if (!empty($type)) {
$r['type'] = $type;
$reference['type'] = $type;
}
}
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r['tokenID']]['substr'] = $r;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r['tokenID']]['row'] = $record;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r['tokenID']]['table'] = $table;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r['tokenID']]['field'] = $field;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r['tokenID']]['uid'] = $idRecord;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $reference['tokenID']]['substr'] = $reference;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $reference['tokenID']]['row'] = $record;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $reference['tokenID']]['table'] = $table;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $reference['tokenID']]['field'] = $field;
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $reference['tokenID']]['uid'] = $idRecord;
}
}

Expand Down

0 comments on commit 9f6f615

Please sign in to comment.