Issue Bug New Orphaned

#109297Incorrect PID resolution for translated pages in workspace preview with identical slugs

Benjamin T. 03/20/26, 08:21 updated 03/20/26, 08:21

Description

*Description*
In TYPO3 workspace preview, slug resolution for translated (non-default language) pages is inconsistent when identical slugs exist across workspace and live records.

*Scenario (anonymized)*
Two language variants (default + translation) exist in both live and workspace, sharing the same slugs:
Live default: /example-path/environment (ID: LIVE_DEFAULT_ID)
Live translated: /translated-path/environment (ID: LIVE_TRANSLATED_ID)
Workspace default: /example-path/environment (ID: WS_DEFAULT_ID)
Workspace translated: /translated-path/environment (ID: WS_TRANSLATED_ID)

*Actual behavior*
Default language request resolves correctly to LIVE_DEFAULT_ID.
Translated request resolves to the workspace default page (WS_DEFAULT_ID) due to fallback to default language.

*Expected behavior*
Translated requests should resolve consistently to the live default page (LIVE_DEFAULT_ID), not the workspace default page.

*Notes*
The issue appears to stem from fallback logic preferring workspace records for translated pages while preferring live records for default language pages.

*References*
vendor/typo3/cms-core/Classes/Routing/PageRouter.php:560ff
vendor/typo3/cms-core/Classes/Routing/PageSlugCandidateProvider.php:206ff

Temporary fix

--- a/Classes/Routing/PageSlugCandidateProvider.php
+++ b/Classes/Routing/PageSlugCandidateProvider.php
@@ -206,7 +206,7 @@ class PageSlugCandidateProvider
             // Exact match will be first, that's important
             ->orderBy('slug', 'desc')
             // versioned records should be rendered before the live records
-            ->addOrderBy('t3ver_wsid', 'desc')
+            ->addOrderBy('t3ver_wsid', (($workspaceId > 0 && $languageId > 0) ? 'asc' :'desc'))
             // Sort pages that are not MountPoint pages before mount points
             ->addOrderBy('mount_pid_ol', 'asc')
             ->addOrderBy('mount_pid', 'asc')
--

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Incorrect PID resolution for translated pages in workspace preview with identical slugs Resolves: #109297 Releases: main