Project

General

Profile

Actions

Bug #88784

closed

Record language is incorrectly changed to default language in overlayLanguageAndWorkspace

Added by Jonas Schwabe almost 5 years ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Extbase
Target version:
-
Start date:
2019-07-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When a record with language uid !=0 is processed while the current language uid is 0 overlayLanguageAndWorkspace incorrectly "transforms" the record into the default language.

The relevant code is as far as I can tell this one:

if (isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) && $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0) {
  //force overlay by faking default language record, as getRecordOverlay can only handle default language records
  $row['uid'] = $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']];
  $row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']] = 0;
}

A foreign language record is handled by overlayLanguageAndWorkspace so the condition passes. The language uid is set to 0 for this record, the record is then considered as main language. When it is next passed into getRecordOverlay it's not being dropped (as it should be in this case).

The above "fake" should only happen if $languageUid is not 0:

if (isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) && $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0 && $languageUid > 0) {
  //force overlay by faking default language record, as getRecordOverlay can only handle default language records
  $row['uid'] = $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']];
  $row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']] = 0;
}

This issue becomes visible e.g. when relations are resolved as in tx_news: https://github.com/georgringer/news/issues/843#issuecomment-511815126


Files

wdb_language_hook.zip (11.3 KB) wdb_language_hook.zip David Bruchmann, 2019-07-16 17:39

Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #81208: Invalid SQL query when previewing a workspace with translated relationsClosedBenni Mack2017-05-12

Actions
Related to TYPO3 Core - Bug #93484: TYPO3 Workspace, Preview module raising exception for versioned plugin recordsClosed2021-02-10

Actions
Related to TYPO3 Core - Bug #87160: Creating site config breaks language processing in news and vhs extensionsResolved2018-12-14

Actions
Actions

Also available in: Atom PDF