[BUGFIX] Exclude fields without db field from advanced search 63/55263/2
authorReiner Teubner <rteubner@me.com>
Wed, 3 Jan 2018 16:53:28 +0000 (17:53 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 4 Jan 2018 11:56:04 +0000 (12:56 +0100)
In advanced search, each field of every table that is listed in TCA
can be used to compose db queries. But if the TCA field has no
counterpart in db, the query fails.
Removing fields that are defined as type user, but without a
defined userfunc are now excluded from view to prevent this kind of
error.

Releases: master, 8.7
Resolves: #83455
Change-Id: Ib35cd7ec54e6c02c77fd85305b6cf3fe1b1979d0
Reviewed-on: https://review.typo3.org/55263
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Database/QueryGenerator.php

index 0215819..b909e1d 100644 (file)
@@ -291,6 +291,10 @@ class QueryGenerator
                 $fC = $GLOBALS['TCA'][$this->table]['columns'][$fieldName];
                 $this->fields[$fieldName] = $fC['config'];
                 $this->fields[$fieldName]['exclude'] = $fC['exclude'];
+                if ($this->fields[$fieldName]['type'] === 'user' && !isset($this->fields[$fieldName]['type']['userFunc'])) {
+                    unset($this->fields[$fieldName]);
+                    continue;
+                }
                 if (is_array($fC) && $fC['label']) {
                     $this->fields[$fieldName]['label'] = rtrim(trim($this->getLanguageService()->sL($fC['label'])), ':');
                     switch ($this->fields[$fieldName]['type']) {