From 9f6f6159bd6ed6ffb65cd15ad0c1aee0a31ac67e Mon Sep 17 00:00:00 2001 From: Oliver Bartsch Date: Fri, 1 Oct 2021 14:24:41 +0200 Subject: [PATCH] [BUGFIX] Fix undefined array key in linkvalidator module Resolves: #95430 Releases: master Change-Id: Ie55e52fb972c5f6a3bf44b321999c9098242bc68 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71401 Tested-by: core-ci Tested-by: Benni Mack Tested-by: Benjamin Franzke Reviewed-by: Benni Mack Reviewed-by: Benjamin Franzke --- .../TypolinkSoftReferenceParser.php | 2 +- .../linkvalidator/Classes/LinkAnalyzer.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/typo3/sysext/core/Classes/DataHandling/SoftReference/TypolinkSoftReferenceParser.php b/typo3/sysext/core/Classes/DataHandling/SoftReference/TypolinkSoftReferenceParser.php index 012c98a5d57a..10ab62000d3c 100644 --- a/typo3/sysext/core/Classes/DataHandling/SoftReference/TypolinkSoftReferenceParser.php +++ b/typo3/sysext/core/Classes/DataHandling/SoftReference/TypolinkSoftReferenceParser.php @@ -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 diff --git a/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php b/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php index 500fc5103fc3..4fdb0e36802e 100644 --- a/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php +++ b/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php @@ -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; } }