Skip to content
Snippets Groups Projects
Commit 515973dd authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Add record title of content in InternalLinkType

In case an internal link targets a content element,
defined by an anchor, this element is checked for
e.g. being moved, hidden or deleted.

In case the element is moved the "title" attribute
was not filled, leading to a PHP warning.

This is now fixed by always adding the correct
record title.

Resolves: #97147
Releases: main, 11.5
Change-Id: Ia78c34465bdc056a5714fc4e1bb7d7981be1e409
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73952


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
parent fde62fd2
Branches
Tags
No related merge requests found
......@@ -15,6 +15,7 @@
namespace TYPO3\CMS\Linkvalidator\Linktype;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -194,7 +195,8 @@ class InternalLinktype extends AbstractLinktype
// (The element might have been moved to another page)
if ($correctPageID !== $page) {
$this->errorParams['errorType']['content'] = self::MOVED;
$this->errorParams['content']['uid'] = (int)$anchor;
$this->errorParams['content']['title'] = BackendUtility::getRecordTitle('tt_content', $row);
$this->errorParams['content']['uid'] = $row['uid'];
$this->errorParams['content']['wrongPage'] = $page;
$this->errorParams['content']['rightPage'] = $correctPageID;
$this->responseContent = false;
......@@ -202,12 +204,12 @@ class InternalLinktype extends AbstractLinktype
// The element is located on the page to which the link is pointing
if ($row['deleted'] == '1') {
$this->errorParams['errorType']['content'] = self::DELETED;
$this->errorParams['content']['title'] = $row['header'];
$this->errorParams['content']['title'] = BackendUtility::getRecordTitle('tt_content', $row);
$this->errorParams['content']['uid'] = $row['uid'];
$this->responseContent = false;
} elseif ($row['hidden'] == '1' || $GLOBALS['EXEC_TIME'] < (int)$row['starttime'] || $row['endtime'] && (int)$row['endtime'] < $GLOBALS['EXEC_TIME']) {
$this->errorParams['errorType']['content'] = self::HIDDEN;
$this->errorParams['content']['title'] = $row['header'];
$this->errorParams['content']['title'] = BackendUtility::getRecordTitle('tt_content', $row);
$this->errorParams['content']['uid'] = $row['uid'];
$this->responseContent = false;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment