Project

General

Profile

Actions

Bug #102124

closed

f:uri.page + language does not work (TypeError)

Added by Kevin Appelt about 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
Start date:
2023-10-09
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Type Error for language:'0'

TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::setLanguage(): Argument #1 ($language) must be of type ?string, int given, called in /var/www/html/vendor/typo3/cms-fluid/Classes/ViewHelpers/Uri/PageViewHelper.php on line 236

Type Error after changing
$language = $arguments['language'] ?? null;
to
$language = isset($arguments['language']) ? (string)$arguments['language'] : null;

TYPO3\CMS\Core\Context\LanguageAspect::__construct(): Argument #1 ($id) must be of type int, string given, called in /var/www/html/vendor/typo3/cms-frontend/Classes/Typolink/PageLinkBuilder.php on line 416

Changing
$page = $pageRepository->getLanguageOverlay('pages', $page, new LanguageAspect($configuration['language'], $configuration['language']));
to
$page = $pageRepository->getLanguageOverlay('pages', $page, new LanguageAspect((int)$configuration['language'], (int)$configuration['language']));
does the job then.

Note: language can be "current" so it can be a string, but for the second change there is $configuration['language'] !== 'current' around it, so casting as int should be okay at this place

Actions

Also available in: Atom PDF