#110281Translation lookup misses translations with empty l10n_source
Description
LocalizationRepository::getRecordTranslation() and getRecordTranslations() look up an existing
translation by matching l10n_source whenever the table defines ctrl.translationSource, and fall
back to transOrigPointerField only when the table has no translation source field at all:
// Prefer translationSourceField (l10n_source) over transOrigPointerField (l10n_parent)
$parentPointerField = $languageCapability->hasTranslationSourceField()
? $languageCapability->getTranslationSourceField()->getName()
: $languageCapability->getTranslationOriginPointerField()->getName();
A translation carrying a correct l10n_parent but an empty l10n_source is therefore not found,
although it is a perfectly valid translation.
Such records are created by TYPO3 itself: a DataHandler datamap which creates a translation by
setting only the language field and l18n_parent does not populate l10n_source. This is the usual way
extensions, importers and migrations create translations, and it produces no error.
Reproduction
The test fixtures of the affected class already contain such records – the pages rows in
typo3/sysext/backend/Tests/Functional/Domain/Repository/Localization/Fixtures/TranslationTestData.csv
have l10n_parent set and no l10n_source column at all. Adding this test to LocalizationRepositoryTest
fails on current main:
#[Test]
public function getRecordTranslationReturnsTranslationWithEmptyTranslationSource(): void
{
$this->importCSVDataSet(__DIR__ . '/Fixtures/TranslationTestData.csv');
$result = $this->subject->getRecordTranslation('pages', 1001, 1);
self::assertNotNull($result);
self::assertSame(1002, $result->getUid());
}
1) LocalizationRepositoryTest::getRecordTranslationReturnsTranslationWithEmptyTranslationSource
Failed asserting that null is not null.
Impact
DataHandler::localize() uses this lookup as its “there already are localizations” guard. Because the
existing translation is invisible, the guard does not trigger and a second translation of the same
record in the same language is created. Repeating the operation multiplies the records.
Verified on TYPO3 13.4 with the predecessor API BackendUtility::getRecordLocalization(), which
carries the identical translationSource / transOrigPointerField expression: a page with a valid
l10n_parent but l10n_source = 0 received a duplicate page translation, and inline children were
attached to the duplicate, making them invisible in the backend.
Suggested fix
Keep preferring l10n_source – it is the more precise field for translation chains – but do not let an
empty value hide the record. Either
- fall back to a transOrigPointerField lookup when the translationSource based query returns nothing, or
- widen the condition to “l10n_source = uid OR (l10n_source = 0 AND l10n_parent = uid)”.
Both keep the current behaviour for well-formed data and only add the records which are currently
lost. The same applies to BackendUtility::getRecordLocalization() in 13.4 and 12.4.
Reviews 9
- 14.3 95540[BUGFIX] Limit translation lookup to records page
- main 95271[BUGFIX] Limit translation lookup to records page
- 13.4 95301[BUGFIX] Cover translation lookup by a single index
- 14.3 95299[BUGFIX] Cover translation lookup by a single index
- main 95297[BUGFIX] Cover translation lookup by a single index
- main 95274[BUGFIX] Tighten DB query for translation lookup in the RecordProvider
- 13.4 94915[BUGFIX] Find translations with empty l10n_source
- 14.3 94916[BUGFIX] Find translations with empty l10n_source
- main 94914[BUGFIX] Find translations with empty l10n_source
Related issues 2
History 59
-
Gerrit Code Review pushed patch set 1 for main to change 94914 status
NewUnder Review <span data-processor="relativetime" data-value="2026-07-23T23:19:35+00:00" > 07/23/26, 23:19 </span> -
Gerrit Code Review pushed patch set 2 for main to change 94914 <span data-processor="relativetime" data-value="2026-07-23T23:21:14+00:00" > 07/23/26, 23:21 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 94915 <span data-processor="relativetime" data-value="2026-07-23T23:40:51+00:00" > 07/23/26, 23:40 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 94916 <span data-processor="relativetime" data-value="2026-07-23T23:51:50+00:00" > 07/23/26, 23:51 </span>
-
Stefan Bürk changed category assigned to Stefan Bürk <span data-processor="relativetime" data-value="2026-07-24T22:36:09+00:00" > 07/24/26, 22:36 </span>
-
Stefan Bürk commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-08-01T18:50:09+00:00" > 08/01/26, 18:50 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-08-11T08:51:54+00:00" > 08/11/26, 08:51 </span> -
Stefan Bürk changed Related to #110454 <span data-processor="relativetime" data-value="2026-08-12T16:19:09+00:00" > 08/12/26, 16:19 </span>
-
Nikita Hovratov changed Related to #110441 <span data-processor="relativetime" data-value="2026-08-24T10:25:09+00:00" > 08/24/26, 10:25 </span>
Applied in changeset commit:c71b2bdb2f9b81eb17176cd297848c2702e77177.