From 0723ba06b5037ff56df9d1be28d0b16f4bdbc912 Mon Sep 17 00:00:00 2001
From: Markus Klein <markus.klein@typo3.org>
Date: Wed, 28 Feb 2018 15:28:06 +0100
Subject: [PATCH] [BUGFIX] Remove undocumented values from Soft Reference Index
 data

The fix for #80991 introduced new data in the data structure returned
by the SoftReferenceIndex class' methods.
This new data stems from LinkHandlers, which may provide arbitrary
data. This causes side effects for consumers of the SoftReferenceIndex
like the reference index and the export functionality.

By removing this extra data - which is not used anywhere at all - the
returned data is again conforming to what is documented and keeps
the interface to the SoftReferenceIndex clean.

Resolves: #84080
Releases: master, 8.7
Change-Id: Ic39a8b593cb239aca698e857d1ee602bdeaf229f
Reviewed-on: https://review.typo3.org/55939
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/core/Classes/Database/SoftReferenceIndex.php | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php b/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
index 8409a1b0148b..d1b63b48f14b 100644
--- a/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
+++ b/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
@@ -270,7 +270,6 @@ class SoftReferenceIndex
                         if ($linkDetails['type'] === LinkService::TYPE_FILE && preg_match('/file\?uid=(\d+)/', $matches[1], $fileIdMatch)) {
                             $token = $this->makeTokenID($key);
                             $linkTags[$key] = str_replace($matches[1], '{softref:' . $token . '}', $linkTags[$key]);
-                            $elements[$key] = $linkDetails;
                             $elements[$key]['subst'] = [
                                 'type' => 'db',
                                 'recordRef' => 'sys_file:' . $fileIdMatch[1],
@@ -280,7 +279,6 @@ class SoftReferenceIndex
                         } elseif ($linkDetails['type'] === LinkService::TYPE_PAGE && preg_match('/page\?uid=(\d+)#?(\d+)?/', $matches[1], $pageAndAnchorMatches)) {
                             $token = $this->makeTokenID($key);
                             $linkTags[$key] = str_replace($matches[1], '{softref:' . $token . '}', $linkTags[$key]);
-                            $elements[$key] = $linkDetails;
                             $elements[$key]['subst'] = [
                                 'type' => 'db',
                                 'recordRef' => 'pages:' . $linkDetails['pageuid'] . (isset($pageAndAnchorMatches[2]) ? '#c' . $pageAndAnchorMatches[2] : ''),
@@ -290,7 +288,6 @@ class SoftReferenceIndex
                         } elseif ($linkDetails['type'] === LinkService::TYPE_URL) {
                             $token = $this->makeTokenID($key);
                             $linkTags[$key] = str_replace($matches[1], '{softref:' . $token . '}', $linkTags[$key]);
-                            $elements[$key] = $linkDetails;
                             $elements[$key]['subst'] = [
                                 'type' => 'external',
                                 'tokenID' => $token,
-- 
GitLab