Issue Bug Closed

#96873Undefined array key "exclude" in GridColumnItem.php

Robert Vock 02/14/22, 08:08 updated 10/04/22, 14:14

Description

I’ve unset the exclude value for the tt_content hidden field, to allow editing by all user-groups without explicitly allowing the hidden field:

unset($GLOBALS['TCA']['tt_content']['columns']['hidden']['exclude']);

When I click the Page module, I get the following error:

PHP Warning: Undefined array key "exclude" in sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php line 305

The fix should be easy: Check, if the field is set or use ?? for a default value:
GridColumnItem.php#L305

As these bugs appear more often with PHP 8, it might be a good idea to ensure some array keys in TCA are always set. The TcaMigration class could ensure that exclude and the ctrl fields (like enablecolumns always exist in the array and are set to false or null to prevent “Undefined array key” warnings).

Reviews 2

History 24

  1. Gerrit Code Review pushed patch set 1 for main to change 73468 status New Under Review 02/14/22, 09:47

  2. Gerrit Code Review pushed patch set 1 for 11.5 to change 73397 02/14/22, 10:19

  3. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 02/14/22, 10:25

    Applied in changeset commit:76bef3563099af1b2096a01b674793c0b728d512.

  4. Benni Mack changed status Resolved Closed 10/04/22, 14:14