#97639Multilang bug in cObjGetSingle. No data is returned for records if sys_language_uid is set to -1.
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
]
)