#111635TCEMAIN.preview.<table>.useDefaultLanguageRecord has no effect
Description
https://review.typo3.org/c/Packages/TYPO3.CMS/+/89843, released with 13.4.15 and 14.0), the page
TSconfig option TCEMAIN.preview.
| useDefaultLanguageRecord | tx_news_pi1[news_preview] |
| not set | 76 (default language) |
| 1 | 76 (default language) |
| 0 | 879 (translation) |
Actual result
tx_news_pi1[news_preview]=879 in all three cases.
Cause
typo3/sysext/backend/Classes/Routing/PreviewUriBuilder.php, getPreviewUrlParameters():
if (!empty($record[$l10nPointer]) && ($previewConfiguration['useDefaultLanguageRecord'] ?? true) === false) {
$recordId = (int)$record[$l10nPointer];
} else {
$recordId = (int)$record['uid'];
}
- TSconfig values are strings (‘0’ / ‘1’), so the strict comparison with false is never true and the
else branch (uid of the translation) is always taken. - The condition is inverted as well: even if the value were false, the default language uid would
be used, which is the opposite of the documented meaning.
Behaviour before the refactoring (EditDocumentController::resolvePreviewRecordId(), up to 13.4.14):
if ($l10nPointer
&& !empty($recordArray[$l10nPointer])
&& (
!isset($previewConfiguration['useDefaultLanguageRecord'])
|| $previewConfiguration['useDefaultLanguageRecord']
)
) {
return (int)$recordArray[$l10nPointer];
}
return (int)$recordArray['uid'];
Possible fix
if (!empty($record[$l10nPointer]) && (bool)($previewConfiguration['useDefaultLanguageRecord'] ?? true)) {
$recordId = (int)$record[$l10nPointer];
} else {
$recordId = (int)$record['uid'];
}
Note: Installations that relied on the current (13.4.15+) behaviour without setting the option will
see the default language uid again after the fix, as documented. They need to set
useDefaultLanguageRecord = 0 explicitly.
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] TCEMAIN.preview.<table>.useDefaultLanguageRecord has no effect Resolves: #111635 Releases: main
History 1
-
Sebastian Stein changed description 11/27/26, 10:20