Project

General

Profile

Actions

Feature #97639

closed

Multilang bug in cObjGetSingle. No data is returned for records if sys_language_uid is set to -1.

Added by JAKOTA Design Group GmbH over 2 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2022-05-16
Due date:
% Done:

100%

Estimated time:
PHP Version:
8.0
Tags:
Complexity:
Sprint Focus:

Description

Request:

cObjGetSingle(
    'CONTENT', 
    [
         'table' => 'tx_extname_domain_model_brand',
        'select.' => [
          'pidInList' => '0',
          'uidInList' => '###brandUid###',
          'selectFields' => 'title',
          'markers.' => [
             'brandUid.' => [
                'data' => 'site:brand',
             ]
          ]
        ]
        'renderObj' => 'COA',
        'renderObj.' => [
          '10' => 'TEXT',
          '10.' => [
             'value' => '{field:title}',
             'insertData' => '1',
          ]
        ]
        'sanitize' => 1
    ]
)

If the record in tx_extname_domain_model_brand is sys_language_uid = 0 or has a translated record everything is fine.

But if the record has sys_language_uid = -1 and the page should be rendered in lang = 1, the marker is not filled.

As far as I can tell the bug is somewhere in

typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

Line 5888 public function getRecords

$statement = $this->exec_getQuery($tableName, $queryConfiguration);

Returns only the columnNames:

 protectedarray(4 items)
         0 => 'title' (5 chars)
         1 => 'uid' (3 chars)
         2 => 'pid' (3 chars)
         3 => 't3ver_state' (11 chars)

But should have also returned the column sys_language_uid.

Because of this missing column the next function call always returns null

$row = $tsfe->sys_page->getLanguageOverlay($tableName, $row);

public/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php

Line 620

 && (int)$row[$tableControl['languageField']] !== -1

is not filled and always false.

As a workaround I added sys_language_uid to the selectFields

Working request:

cObjGetSingle(
    'CONTENT', 
    [
         'table' => 'tx_extname_domain_model_brand',
        'select.' => [
          'pidInList' => '0',
          'uidInList' => '###brandUid###',
          'selectFields' => 'title, sys_language_uid',
          'markers.' => [
             'brandUid.' => [
                'data' => 'site:brand',
             ]
          ]
        ]
        'renderObj' => 'COA',
        'renderObj.' => [
          '10' => 'TEXT',
          '10.' => [
             'value' => '{field:title}',
             'insertData' => '1',
          ]
        ]
        'sanitize' => 1
    ]
)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #97710: Missing languagefield in select causes failing overlay Closed2022-05-31

Actions
Actions

Also available in: Atom PDF