#102124f:uri.page + language does not work (TypeError)
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