[BUGFIX] Prevent crash in DatabaseIntegrityCheck 21/58221/2
authorAnja <aleichsenring@ab-softlab.de>
Fri, 7 Sep 2018 15:31:05 +0000 (17:31 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 7 Sep 2018 15:59:36 +0000 (17:59 +0200)
If a relation field (select / group) does not exist in db for
whatever reason, System -> DB check -> Database relations
crashes.

Resolves: #86167
Releases: master, 8.7
Change-Id: Id6a502d56b985f6410f40a1f547fe7b923e9d982
Reviewed-on: https://review.typo3.org/58221
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/Integrity/DatabaseIntegrityCheck.php

index d61ceed..0265272 100644 (file)
@@ -440,6 +440,14 @@ class DatabaseIntegrityCheck
                         // It is quoted for keywords
                         $column = $tableColumns[strtolower($fieldName)]
                             ?? $tableColumns[$connection->quoteIdentifier(strtolower($fieldName))];
+                        if (!$column) {
+                            // Throw meaningful exception if field does not exist in DB - 'none' is not filtered here since the
+                            // method is only called with type=group fields
+                            throw new \RuntimeException(
+                                'Field ' . $fieldName . ' for table ' . $table . ' has been defined in TCA, but does not exist in DB',
+                                1536248936
+                            );
+                        }
                         $fieldType = $column->getType()->getName();
                         if (in_array(
                             $fieldType,