Skip to content
Snippets Groups Projects
Commit 1a2e8761 authored by Thomas Hohn's avatar Thomas Hohn Committed by Christian Kuhn
Browse files

[BUGFIX] Fix type error in UnableToLinkException->getLinkText

The type hint indicates, that $linkText should be of type string.
However this is not always the case. In TYPO3 v11, it can contain
an instance of LinkResult.
The code has been refactored in TYPO3 v12 and since the
potential code has been removed from ContentObjectRenderer this
fix is to be considered temporary.

Resolves: #100106
Releases: 11.5
Change-Id: I61ba89651c77496ec5cc986a435a758466b03067
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78074


Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent b52c6659
Branches
Tags
No related merge requests found
......@@ -35,12 +35,16 @@ class UnableToLinkException extends Exception
* @param string $message [optional] The Exception message to throw.
* @param int $code [optional] The Exception code.
* @param \Throwable $previous [optional] The previous throwable used for the exception chaining.
* @param string $linkText [optional]
* @param LinkResult|string $linkText [optional]
*/
public function __construct($message = '', $code = 0, \Throwable $previous = null, $linkText = '')
{
parent::__construct($message, $code, $previous);
$this->linkText = $linkText;
if ($linkText instanceof LinkResult) {
$this->linkText = $linkText->getLinkText() ?? '';
} else {
$this->linkText = (string)$linkText;
}
}
/**
......
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