Issue Bug Closed

#84738Doctrine\DBAL\Exception\SyntaxErrorException in CType: menu_categorized_content

Georg Tiefenbrunn 04/16/18, 10:34 updated 10/02/18, 10:47

Description

TYPO3 CMS Version 9 (master) and 8.x
Caused by TypoScript/SQL (PHP Version does not matter)

Steps to reproduce: Create a new element with CType menu_categorized_content and do not select any Categories (‘Selected categories’/@tt_content.selected_categories@).

Uncaught TYPO3 Exception

An exception occurred while executing 'SELECT tt_content.* FROM `tt_content` INNER JOIN ... AND sys_category_record_mm.uid_local IN() WHERE ...

Doctrine\DBAL\Exception\SyntaxErrorException thrown in file
.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php in line 90.

See https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuCategorizedContent.txt

My quick and dirty fix (for MariaDB/MySql) is to simply add 0 to the SQL IN() part:

tt_content.menu_categorized_content.dataProcessing.10 {
  # Alter the existing query
#  join.wrap = sys_category_record_mm ON uid = sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(|)
  join.wrap = sys_category_record_mm ON uid = sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(0|)

  # OR add the zero using stdWrap
  join.stdWrap.wrap = 0|
}

Reviews 2