Skip to content

Commit

Permalink
[BUGFIX] Fix TypeErrors when using language argument
Browse files Browse the repository at this point in the history
Resolves: #102124
Releases: main, 12.4
Change-Id: I8b3862f70d5a8eb9779bb72c945bcf4e067d59eb
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81342
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
  • Loading branch information
kevin-appelt authored and sbuerk committed Oct 9, 2023
1 parent a57148d commit 2538e0e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Expand Up @@ -104,7 +104,7 @@ protected function renderFrontendLinkWithCoreContext(ServerRequestInterface $req
$pageType = (int)($this->arguments['pageType'] ?? 0);
$noCache = (bool)($this->arguments['noCache'] ?? false);
/** @var string|null $language */
$language = $this->arguments['language'] ?? null;
$language = isset($this->arguments['language']) ? (string)$this->arguments['language'] : null;
/** @var string|null $section */
$section = $this->arguments['section'] ?? null;
$linkAccessRestrictedPages = (bool)($this->arguments['linkAccessRestrictedPages'] ?? false);
Expand Down Expand Up @@ -212,7 +212,7 @@ protected function renderWithExtbaseContext(ExtbaseRequestInterface $request): s
$pageUid = (int)$this->arguments['pageUid'] ?: null;
$pageType = (int)($this->arguments['pageType'] ?? 0);
$noCache = (bool)($this->arguments['noCache'] ?? false);
$language = $this->arguments['language'] ?? null;
$language = isset($this->arguments['language']) ? (string)$this->arguments['language'] : null;
$section = (string)$this->arguments['section'];
$format = (string)$this->arguments['format'];
$linkAccessRestrictedPages = (bool)($this->arguments['linkAccessRestrictedPages'] ?? false);
Expand Down
Expand Up @@ -141,7 +141,7 @@ protected function renderFrontendLinkWithCoreContext(ServerRequestInterface $req
$pageType = isset($this->arguments['pageType']) ? (int)$this->arguments['pageType'] : 0;
$noCache = isset($this->arguments['noCache']) && (bool)$this->arguments['noCache'];
$section = isset($this->arguments['section']) ? (string)$this->arguments['section'] : '';
$language = $this->arguments['language'] ?? null;
$language = isset($this->arguments['language']) ? (string)$this->arguments['language'] : null;
$linkAccessRestrictedPages = isset($this->arguments['linkAccessRestrictedPages']) && (bool)$this->arguments['linkAccessRestrictedPages'];
$additionalParams = isset($this->arguments['additionalParams']) ? (array)$this->arguments['additionalParams'] : [];
$absolute = isset($this->arguments['absolute']) && (bool)$this->arguments['absolute'];
Expand Down Expand Up @@ -250,7 +250,7 @@ protected function renderWithExtbaseContext(ExtbaseRequestInterface $request): s
$pageType = isset($this->arguments['pageType']) ? (int)$this->arguments['pageType'] : 0;
$noCache = isset($this->arguments['noCache']) && (bool)$this->arguments['noCache'];
$section = isset($this->arguments['section']) ? (string)$this->arguments['section'] : '';
$language = $this->arguments['language'] ?? null;
$language = isset($this->arguments['language']) ? (string)$this->arguments['language'] : null;
$linkAccessRestrictedPages = isset($this->arguments['linkAccessRestrictedPages']) && (bool)$this->arguments['linkAccessRestrictedPages'];
$additionalParams = isset($this->arguments['additionalParams']) ? (array)$this->arguments['additionalParams'] : [];
$absolute = isset($this->arguments['absolute']) && (bool)$this->arguments['absolute'];
Expand Down
Expand Up @@ -155,7 +155,7 @@ protected static function invokeContentObjectRenderer(array $arguments, string $
'forceAbsoluteUrl' => $absolute,
];
if (isset($arguments['language']) && $arguments['language'] !== null) {
$instructions['language'] = $arguments['language'];
$instructions['language'] = (string)$arguments['language'];
}
if ($addQueryString && $addQueryString !== 'false') {
$instructions['addQueryString'] = $addQueryString;
Expand Down
Expand Up @@ -94,7 +94,7 @@ protected static function renderFrontendLinkWithCoreContext(ServerRequestInterfa
$pageType = (int)($arguments['pageType'] ?? 0);
$noCache = (bool)($arguments['noCache'] ?? false);
/** @var string|null $language */
$language = $arguments['language'] ?? null;
$language = isset($arguments['language']) ? (string)$arguments['language'] : null;
/** @var string|null $section */
$section = $arguments['section'] ?? null;
$linkAccessRestrictedPages = (bool)($arguments['linkAccessRestrictedPages'] ?? false);
Expand Down Expand Up @@ -191,7 +191,7 @@ protected static function renderWithExtbaseContext(ExtbaseRequestInterface $requ
$pageType = (int)($arguments['pageType'] ?? 0);
$noCache = (bool)($arguments['noCache'] ?? false);
/** @var string|null $language */
$language = $arguments['language'] ?? null;
$language = isset($arguments['language']) ? (string)$arguments['language'] : null;
/** @var string|null $section */
$section = $arguments['section'] ?? null;
/** @var string|null $format */
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/fluid/Classes/ViewHelpers/Uri/PageViewHelper.php
Expand Up @@ -164,7 +164,7 @@ protected static function renderFrontendLinkWithCoreContext(ServerRequestInterfa
$pageType = isset($arguments['pageType']) ? (int)$arguments['pageType'] : 0;
$noCache = isset($arguments['noCache']) && (bool)$arguments['noCache'];
$section = isset($arguments['section']) ? (string)$arguments['section'] : '';
$language = $arguments['language'] ?? null;
$language = isset($arguments['language']) ? (string)$arguments['language'] : null;
$linkAccessRestrictedPages = isset($arguments['linkAccessRestrictedPages']) && (bool)$arguments['linkAccessRestrictedPages'];
$additionalParams = isset($arguments['additionalParams']) ? (array)$arguments['additionalParams'] : [];
$absolute = isset($arguments['absolute']) && (bool)$arguments['absolute'];
Expand Down Expand Up @@ -220,7 +220,7 @@ protected static function renderWithExtbaseContext(ExtbaseRequestInterface $requ
$pageType = (int)($arguments['pageType'] ?? 0);
$noCache = $arguments['noCache'];
$section = $arguments['section'];
$language = $arguments['language'] ?? null;
$language = isset($arguments['language']) ? (string)$arguments['language'] : null;
$linkAccessRestrictedPages = $arguments['linkAccessRestrictedPages'];
$absolute = $arguments['absolute'];
$addQueryString = $arguments['addQueryString'] ?? false;
Expand Down
Expand Up @@ -99,7 +99,7 @@ protected static function invokeContentObjectRenderer(array $arguments, string $
'forceAbsoluteUrl' => $absolute,
];
if (isset($arguments['language']) && $arguments['language'] !== null) {
$instructions['language'] = $arguments['language'];
$instructions['language'] = (string)$arguments['language'];
}
if ($addQueryString && $addQueryString !== 'false') {
$instructions['addQueryString'] = $addQueryString;
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php
Expand Up @@ -413,7 +413,7 @@ protected function resolvePage(array &$linkDetails, array &$configuration, bool
// It is needed to also resolve the page translation now, as it might have a different shortcut
// page
if (isset($configuration['language']) && $configuration['language'] !== 'current') {
$page = $pageRepository->getLanguageOverlay('pages', $page, new LanguageAspect($configuration['language'], $configuration['language']));
$page = $pageRepository->getLanguageOverlay('pages', $page, new LanguageAspect((int)$configuration['language'], (int)$configuration['language']));
}

$page = $this->resolveShortcutPage($page, $pageRepository, $disableGroupAccessCheck);
Expand Down

0 comments on commit 2538e0e

Please sign in to comment.