Issue Bug Closed

#58180Database query error for non-workspaces tables

rengaw83 04/25/14, 11:06 updated 10/02/18, 11:58

Description

When i have to check if a record exists and is accessible, i do that with the checkRecord method in the page repository:

/* @var $sysPage \TYPO3\CMS\Frontend\Page\PageRepository */
$sysPage = $GLOBALS['TSFE']->sys_page;
$sysPage->checkRecord('tx_extension_table', $uid, 1);

It the Table is not localizable or verionable and you are in a versioning preview, the following error occurs:

caller     TYPO3\CMS\Core\Database\DatabaseConnection::exec_SELECTquery
ERROR     Unknown column 't3ver_oid' in 'where clause'
lastBuiltQuery     SELECT uid,pid,tstamp,crdate,hidden,starttime,endtime,sorting,fe_group,title,title_lang_ol,image,shortcut,shortcut_target,deleted,single_pid,parent_category,description FROM tt_news_cat WHERE pid=-1 AND t3ver_oid=1 AND t3ver_wsid=1 AND tt_news_cat.deleted=0 LIMIT 1
debug_backtrace     require(index_t3.php),index.php#37 // require(typo3\sysext\cms\tslib\index_ts.php),index_t3.php#41 // TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript#204 // TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->recursivelyReplaceIntPlaceholdersInContent#3425 // TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript_process#3451 // TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->USER#3503 // TYPO3\CMS\Frontend\ContentObject\UserContentObject->render#905 // TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->callUserFunction#55 // call_user_func_array#6439 // tx_ttnews->main_news# // tx_ttnews->initCategoryVars#188 // tx_ttnews_helpers->checkRecords#3733 // TYPO3\CMS\Frontend\Page\PageRepository->checkRecord#104 // TYPO3\CMS\Frontend\Page\PageRepository->versionOL#713 // TYPO3\CMS\Frontend\Page\PageRepository->getWorkspaceVersionOfRecord#1039 // TYPO3\CMS\Core\Database\DatabaseConnection->exec_SELECTgetSingleRow#1164 // TYPO3\CMS\Core\Database\DatabaseConnection->exec_SELECTquery#400 // TYPO3\CMS\Core\Database\DatabaseConnection->debug#297

The Problem here ist, that the method versionOL is called, without a check for versionable table.

A good example ist the ‘tt_news_cat’‘ table of the tt_news extension.
See #57187

The same problem orrurs on the cObjGetSingle call for the rendering:

exec_SELECTquery
caller     TYPO3\CMS\Core\Database\DatabaseConnection::exec_SELECTquery
ERROR     Unknown column 't3ver_oid' in 'where clause'
lastBuiltQuery     SELECT uid,pid,tstamp,crdate,hidden,starttime,endtime,sorting,fe_group,title,title_lang_ol,image,shortcut,shortcut_target,deleted,single_pid,parent_category,description FROM tt_news_cat WHERE pid=-1 AND t3ver_oid=7 AND t3ver_wsid=1 AND tt_news_cat.deleted=0 LIMIT 1
debug_backtrace     require(index_t3.php),index.php#37 // require(typo3\sysext\cms\tslib\index_ts.php),index_t3.php#41 // TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript#204 // TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->recursivelyReplaceIntPlaceholdersInContent#3425 // TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript_process#3451 // TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->USER#3503 // TYPO3\CMS\Frontend\ContentObject\UserContentObject->render#905 // TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->callUserFunction#55 // call_user_func_array#6439 // tx_ttnews->main_news# // tx_ttnews->displayList#206 // tx_ttnews->getListContent#726 // tx_ttnews->getItemMarkerArray#1036 // tx_ttnews->getGenericMarkers#1761 // TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle#1918 // TYPO3\CMS\Frontend\ContentObject\RecordsContentObject->render#739 // TYPO3\CMS\Frontend\Page\PageRepository->versionOL#82 // TYPO3\CMS\Frontend\Page\PageRepository->getWorkspaceVersionOfRecord#1039 // TYPO3\CMS\Core\Database\DatabaseConnection->exec_SELECTgetSingleRow#1164 // TYPO3\CMS\Core\Database\DatabaseConnection->exec_SELECTquery#400 // TYPO3\CMS\Core\Database\DatabaseConnection->debug#297

The Problem here ist the same of the checkRecord call.

I am not shure, but i think a check for versioning in the ctrl section of the TCA should solve the problem

Reviews 3