Project

General

Profile

Bug #104396

Updated by Hannes Lau 4 months ago

 
 In https://github.com/TYPO3/typo3/blob/12.4/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L5031 the andWhere Clause `'AND t3ver_oid=0'` is always appended, even for tables without versioning. This leads to an invalid field exception `unknown column t3ver_oid`.  

 Original: 
 <pre><code class="php"> 
 $parentRecordLocalization = BackendUtility::getRecordLocalization($table, $id, $command['language'], 'AND t3ver_oid=0'); 
 </code></pre> 

 Quick patch was: 
 <pre><code class="php"> 
 -              $parentRecordLocalization = BackendUtility::getRecordLocalization($table, $id, $command['language'], 'AND t3ver_oid=0'); 
 +              $useVersioning = (bool) ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] ?? false); 
 +              $versioningWhereClause = $useVersioning ? 'AND t3ver_oid=0' : ''; 
 +              $parentRecordLocalization = BackendUtility::getRecordLocalization($table, $id, $command['language'], $versioningWhereClause); 

 </code></pre> 

Back