Bug #86167

Having a field in TCA but not in database makes the DatabaseIntegrityCheck crash

Added by Stefan P over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2018-09-06
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Ticket #79992 is somehow related.

sysext/core/Classes/Integrity/DatabaseIntegrityCheck.php line 443 throws a Null Pointer exception if a field is declared in TCA but not actually present in the database. I see two possible solutions here:
  1. only iterate over the intersection between TCA fields and actual database fields
  2. echo a note that there's a field declared that is not present and continue the loop with the next field

I prefer solution two, because it'd provide a nice check if there's some inconsistent/obsolete TCA configuration which should be fixed.


Related issues

Related to TYPO3 Core - Bug #86092: Do not fetch type=none fields from db in list module Closed 2018-09-03
Related to TYPO3 Core - Bug #79992: Error in DB Check -> Database Relations Closed 2017-02-24

Associated revisions

Revision a8986450 (diff)
Added by Christian Kuhn over 1 year ago

[BUGFIX] Prevent crash in DatabaseIntegrityCheck

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/58201
Tested-by: TYPO3com <>
Reviewed-by: Andreas Fernandez <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Richard Haeser <>
Tested-by: Richard Haeser <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

Revision 4b4cd430 (diff)
Added by Anja Leichsenring over 1 year ago

[BUGFIX] Prevent crash in DatabaseIntegrityCheck

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 <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Georg Ringer over 1 year ago

  • Related to Bug #86092: Do not fetch type=none fields from db in list module added

#2 Updated by Georg Ringer over 1 year ago

  • Status changed from New to Needs Feedback

Maybe it has been solved for you with #86092.

However how do you define the field in TCA? please add some code and explain (if not using type none) why there should be no related field in the DB. Thanks

#3 Updated by Stefan P over 1 year ago

I had the field fe_group in the columns section of some TCA files, but did not have the field in ext_tables.sql (because the table didn't use frontend authentification features). I know that this is actually a wrong configuration (good old copy-paste error) - but it seems only to fail in the DatabaseIntegrityCheck, that's how I noticed this behaviour.

#86092 has nothing to do with it (the list module works fine).

IMHO the DatabaseIntegrityCheck should actually check if a field is present in the database schema before accessing it and throw some kind of notice instead of just failing with a null pointer exception.

#4 Updated by Christian Kuhn over 1 year ago

  • Assignee set to Christian Kuhn

i'm fiddling in a similar area at the moment and can have a look at this case.

#5 Updated by Christian Kuhn over 1 year ago

  • Related to Bug #79992: Error in DB Check -> Database Relations added

#6 Updated by Christian Kuhn over 1 year ago

I'll push a patch to prevent the crash.

A check to verify TCA and ext_tables.sql are in sync should not belong to this module, though. imho, the entire db check / lowlevel thing needs rethinking, we may eventually do that with v10 (v9 is feature frozen already). Thus for now, I think it is enough to prevent the crash and further work on this topic in a future core version.

#7 Updated by Gerrit Code Review over 1 year ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58201

#8 Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58201

#9 Updated by Christian Kuhn over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#10 Updated by Gerrit Code Review over 1 year ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58221

#11 Updated by Anja Leichsenring over 1 year ago

  • Status changed from Under Review to Resolved

#12 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF