Project

General

Profile

Actions

Bug #102124

closed

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

Added by Kevin Appelt 7 months ago. Updated 7 months ago.

Status:
Resolved
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 #1

Updated by Gerrit Code Review 7 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81382

Actions #2

Updated by Gerrit Code Review 7 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81342

Actions #3

Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81382

Actions #4

Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81342

Actions #5

Updated by Kevin Appelt 7 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF