Review main Merged

69012[BUGFIX] Resolve PHP 8 issues in acceptance tests

crell CR +2 V +2 Hard +492 −422 updated 11/19/21, 15:41

Commit message

PHP 8 promotes a lot of notices (previously ignored) to warnings.
That means they can no longer be ignored.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 91

Show 71 more files

Review log 5578

Show 3653 earlier messages
  1. crell uploaded patch set 1 05/04/21, 15:55

  2. Christian Kuhn commented on patch set 1 05/04/21, 15:59

    SimpleFileBackend.php:293

    unlink() throws warning even with @ if file does not exist in php 8?
  3. core-ci voted on patch set 1 V +1 05/04/21, 16:07 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11128

  4. crell uploaded patch set 2 05/04/21, 21:37

  5. core-ci voted on patch set 2 V +1 05/04/21, 21:48 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11179

  6. Benni Mack commented on patch set 2 05/05/21, 14:40

    Looks like EXT:styleguide still has some issues... [TYPO3\CMS\Core\Error\Exception (1476107295)] PHP Warning: Undefined array key "tx_styleguide_ctrl_minimal" in typo3conf/ext/styleguide/Classes/TcaDataGenerator/TableHandler/AbstractTableHandler.php line 64
  7. crell uploaded patch set 3 05/05/21, 19:33

  8. core-ci voted on patch set 3 V -1 05/05/21, 19:45 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11232

  9. crell uploaded patch set 4 05/05/21, 22:21

  10. core-ci voted on patch set 4 V -1 05/05/21, 22:44 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11233

  11. Tymoteusz Motylewski commented on patch set 4 05/06/21, 05:37

    TcaColumnsProcessFieldLabels.php:88

    in case of the empty string, this will change behaviour, right? i havent dig into it to say whether its ok or not.
  12. Markus Klein commented on patch set 4 05/06/21, 07:53

    ConditionMatcher.php:45

    Are you ignoring $rootLine now on purpose?
  13. Markus Klein commented on patch set 4 05/06/21, 08:39

    Clipboard.php:127

    must be !empty()
  14. Christian Kuhn commented on patch set 4 05/06/21, 12:35

    Reply

    fixing in styleguide now.
  15. Jochen Roth commented on patch set 4 V -1 05/06/21, 15:59

    -1 for now because some features are broken. Thanks for working on php8 support :-)

    TcaInline.php:466

    $parentConfig['MM'] ?? [] should be $parentConfig['MM'] ?? '' Otherwise it throws Argument 3 passed to TYPO3\CMS\Core\Database\RelationHandler::start() must be of the type string, array given, called in /var/www/html/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInline.php on line 466

    RelationHandler.php:253

    Argument 4 passed to TYPO3\CMS\Core\Database\RelationHandler::start() must be of the type int, string given, called in /var/www/html/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php on line 915 When creating a new element, it gets an temporary UID like "NEW6093f6bc38de5740426432" therefore $MMuid should not enforce "int"

    RelationHandler.php:1060

    Space after equals

    Comparator.php:64

    Remove var_dump()

    Comparator.php:64

    Remove var_dump()

    FileListController.php:352

    Causes the thumbnails to display always no matter if the checkbox was ticked. Possible solution taken from initClipboard() method $this->filelist->thumbs = ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] ?? false) && ($this->MOD_SETTINGS['displayThumbs'] ?? false);
  16. crell commented on patch set 4 05/06/21, 22:08

    Reply

    Yes. Because of the way acceptance tests run, every warning gets converted to an exception so I have to rerun the test suite, fix the half dozen issues it finds, then run it again and fix the next half dozen, etc. It's definitely not done yet. At this point I just want some eyes on it to see if there would be a better, more centralized approach in some cases that I'm not aware of.
    Updated based on feedback. Thanks folks! Somewhere along the way I introduced a single fail in the unit tests for TcaSelectItemsTest, but I'm unclear how or why. Tips welcome. 😊

    Clipboard.php:127 Reply

    Ack

    TcaColumnsProcessFieldLabels.php:88 Reply Unresolved

    Nominally yes, but in practice no. The next line checks if this value is `empty()`, and both empty string and null return true there. So I don't believe there's any change in practice.

    TcaInline.php:466 Reply

    Ack

    RelationHandler.php:253 Reply

    Gross. :-) Updating the docblock accordingly.

    RelationHandler.php:1060 Reply

    Done

    Comparator.php:64 Reply

    Forgot those. The array_diff_assoc() line is failing but I am having a hard time determining why. Specifically, the second parameter apparently has non-string values at times (eg, arrays), but array_diff_assoc() compares the two arrays as string values. Thus the second is resulting in "array to string conversion" errors. I don't know enough about how/why that is to fix it. Any suggestions or pointers?

    Comparator.php:64 Reply

    Done

    FileListController.php:352 Reply

    Ack

    ConditionMatcher.php:45 Reply

    Ah, nope. That's my error. Good catch. Fixed.
  17. crell uploaded patch set 5 05/06/21, 22:08

  18. Christian Kuhn commented on patch set 5 05/06/21, 22:22

    Reply

    fixed this one in styleguide and released. it's not raised in core yet, though. (pending with other patch, hope that one makes it soon). if you need the fix, just clone styleguide master branch to typo3conf/ext for the time being, please.
  19. core-ci voted on patch set 5 V -1 05/06/21, 22:33 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11274

  20. Jochen Roth commented on patch set 5 05/07/21, 09:31

    Comparator.php:64 Reply Unresolved

    Sorry, can't reproduce this.
  21. crell uploaded patch set 6 05/07/21, 20:25

  22. core-ci voted on patch set 6 V -1 05/07/21, 20:28 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11304

  23. crell uploaded patch set 7 05/07/21, 20:35

  24. core-ci voted on patch set 7 V -1 05/07/21, 20:57 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11305

  25. crell uploaded patch set 8 05/07/21, 21:26

  26. core-ci commented on patch set 8 05/07/21, 21:49 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11306

  27. crell uploaded patch set 9 05/07/21, 22:27

  28. core-ci voted on patch set 9 V -1 05/07/21, 22:42 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11310

  29. crell uploaded patch set 10 05/10/21, 15:58

  30. core-ci voted on patch set 10 V -1 05/10/21, 16:09 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11351

  31. crell uploaded patch set 11 05/10/21, 16:38

  32. core-ci voted on patch set 11 V -1 05/10/21, 16:49 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11354

  33. Richard Haeser uploaded patch set 12 05/10/21, 19:35

  34. core-ci voted on patch set 12 V +1 05/10/21, 19:49 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11363

  35. Richard Haeser uploaded patch set 13 05/10/21, 20:04

  36. crell commented on patch set 13 CR +1 05/10/21, 20:12

    Thanks, Richard, for finding the last few gotchas. This doesn't fix all PHP 8 issues, but it does fix a huge swath of them. I'd like to get this much committed first before continuing to reduce the patch size, so please bring your reviewing microscopes.

    SimpleFileBackend.php:293 Reply

    Done
  37. core-ci voted on patch set 13 V +1 05/10/21, 20:15 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11364

  38. Oli Bartsch commented on patch set 13 CR -1 05/11/21, 16:13

    Hi, thanks for your patch. I had a look through the files and added some comments regarding changed behaviour, (possible) breaking changes and some suggestions. Will do a more in depth review in the next days.

    Clipboard.php:130

    Change in behaviour. Previously checked for array. Now only check for existence of the key.

    Clipboard.php:132

    Change in behaviour. Previously checked for array. Now only check for existence of the key.

    Clipboard.php:164

    Change in behaviour. Previously checked for array. Now only check for existence of the key. Would lead to PHP Warning, in case the value is no traversable.

    TranslationConfigurationProvider.php:192

    Would still lead to Undefined array key warning in case `$GLOBALS['TCA'][$table]['ctrl']['languageField']` is not defined.

    NewContentElementController.php:382

    Change in behaviour. Previously checked for array. Now only check for existence of the key.

    NewContentElementController.php:415

    Change in behaviour. Previously checked for array. Now only check for existence of the key. Would lead to PHP Warning, in case the value is no traversable.

    NewContentElementController.php:441

    Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.

    TreeController.php:164

    Change in behaviour. Now $this->expandedState['stateHash'] will always be assigned, even if "empty", as soon as the array key exists and the value is not null.

    TreeController.php:406

    Change in behaviour. Previously the assigned value was always casted to int, but can now be anything.

    InlineControlContainer.php:269

    null coalescing is not necessary here since isset() already checks for existence of the key. The whole check could IMO be simplified by just using `!empty($config['appearance']['showAllLocalizationLink'])`.

    InlineControlContainer.php:308

    When using strict, I would suggest to apply the necessary type to the needle: (string)($config['appearance']['levelLinksPosition'] ?? '').

    InlineControlContainer.php:353

    When using strict, I would suggest to apply the necessary type to the needle: (string)($config['appearance']['levelLinksPosition'] ?? '').

    InlineControlContainer.php:384

    Change in behaviour. getValidationDataAsJsonString() checks "maxitems" with isset. This would now evaluate to TRUE and therefore set maxitems to 0 instead of 99999. I suggest to use `?? null` instead, also for minitems.

    SingleFieldContainer.php:85

    Change in behaviour. Previously checked for array, now always assigned, even if value is not an array.

    ImageManipulationElement.php:292

    is_null will raise an undefined array key warning, in case the key does not exist.

    DatabaseRowDefaultValues.php:56

    Typecast to string should IMO still be applied here.

    DatabaseRowDefaultValues.php:62

    Typecast to string should IMO still be applied here.

    TcaColumnsProcessFieldLabels.php:88

    Change in behaviour. Now $aPalettesArray[1] will always be assigned, even if "empty", as soon as the array key exists and the value is not null.

    TcaInline.php:113

    Would still lead to Undefined array key warning in case `$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']` is not defined.

    TcaInline.php:465

    Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.

    TcaInlineExpandCollapseState.php:70

    Would suggest to use '' or null here.

    RouteDispatcher.php:144

    Let's do empty string '' here. This will also lead to false. -1 has a different meaning in various places in TYPO3. For example we used this as pageId until v11 to hide workspace records from live views.

    FileStorageTreeProvider.php:284

    Change in behaviour. Now $this->expandedState['stateHash'] will always be assigned, even if "empty", as soon as the array key exists and the value is not null.

    BackendUtility.php:235

    This will fail with a TypeError in case $ctrl is no array.

    BackendUtility.php:236

    Why do we add the array here? The below if clause will then always be true.

    BackendUtility.php:2428

    This is a breaking change, since the method is not marked as internal.

    BackendUtility.php:3450

    This is a breaking change, since 3rd party code may relies on $row being set to FALSE. Especially because the PHPDoc still states this.

    ArrayBrowser.php:109

    Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.

    BackendLayoutView.php:188

    Change in behaviour. Previously the assigned value was always casted to string, but can now be anything.

    PageLayoutContext.php:117

    Change in behaviour. Previously the assigned value was always casted to integer, but can now be anything.

    BackendUserAuthentication.php:81

    There is another patch where we want to get rid this, see: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68795.

    BackendUserAuthentication.php:1246

    I prefer using null coalescing below instead of filling the array with these default values.

    SimpleFileBackend.php:292

    Should we suppress warning for file_exists, too?

    ReferenceIndex.php:312

    Change in behaviour. Previously the checked value was always casted to string, but can now be anything.

    FileSearchQuery.php:102

    Change in behaviour. $GLOBALS['TCA'][self::FILES_TABLE]['ctrl']['sortby'] is now always assigned (as soon as the key exists), even if "empty".

    SearchTermRestriction.php:91

    This will now lead to a type error in case $fieldConfig['search'] is not an array and not null.

    ExtendedTemplateService.php:922

    Change in behaviour. Previously checked for array, now also true even if not an array but evaluated to !empty.

    MathUtility.php:32

    Breaking change, since this is public API.

    FileListController.php:395

    Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.

    FileListController.php:475

    Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.

    FileListController.php:849

    Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.

    ConfigurationController.php:93

    Will lead to TypeError in case $postValues['searchString'] is not a string and not null.

    DatabaseIntegrityCheck.php:360

    Would prefer using '' here since we compare to a string.

    RecordListController.php:160

    Will lead to notice/warning in case enableClipBoard is not defined.

    DatabaseRecordList.php:836

    Would still lead to Undefined array key warning in case `$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']` is not defined.

    DatabaseRecordList.php:845

    Will now lead to TypeError in case the value is not an integer.

    DatabaseRecordList.php:1060

    Change in behaviour. Will now also assigned, even if no array.

    DatabaseRecordList.php:3268

    Would still lead to Undefined array key warning in case `$GLOBALS['TCA'][$table]['ctrl']['languageField']` is not defined.

    SchedulerModuleController.php:241

    Change in behaviour. Previously the assigned value was always casted to int, but can now be anything.

    SetupModuleController.php:247

    Would prefer using '' here since we compare to a string.

    TypoScriptTemplateConstantEditorModuleFunctionController.php:136

    Change in behaviour. Now $this->templateRow['_ORIG_uid'] will always be assigned, even if "empty", as soon as the array key exists and the value is not null.

    TypoScriptTemplateInformationModuleFunctionController.php:150

    Change in behaviour. Now $this->templateRow['_ORIG_uid'] will always be assigned, even if "empty", as soon as the array key exists and the value is not null.
  39. crell uploaded patch set 14 05/11/21, 21:08

  40. crell commented on patch set 13 CR 0 05/11/21, 21:09

    Updated based on feedback from Oliver Bartsch. Thanks! A few pieces are still pending some feedback, as noted in other comments.

    Clipboard.php:130 Reply

    Done

    Clipboard.php:132 Reply

    Done

    Clipboard.php:164 Reply

    Done

    TranslationConfigurationProvider.php:192 Reply

    3v4l says that's fine: https://3v4l.org/srU6D

    NewContentElementController.php:382 Reply

    Done

    NewContentElementController.php:415 Reply

    Done

    NewContentElementController.php:441 Reply

    Done

    TreeController.php:164 Reply

    I don't follow. $this->expandedState is already defaulted to [] in the property definition (which is good). If it gets momentarily set to an object, that will get cast back down to an array. (Using the property as a temp variable in this snippet is totally confusing and I'm having a hard time following what's even going on here.) The only gap in this code is if $this-expandedState['stateHash'] is set and not an array, which I can't see how that would happen. What actually is going on in this code? It can probably be rewritten entirely to be both clearer and more type safe.

    TreeController.php:406 Reply

    Done

    InlineControlContainer.php:269 Reply

    Done

    InlineControlContainer.php:308 Reply

    Does it matter here? Arrays are inherently untyped, so any value other than the two possible ones would result in the same behavior. I'm trying to avoid force casting unless absolutely necessary, as that's generally a code smell.

    InlineControlContainer.php:353 Reply

    Ibid.

    InlineControlContainer.php:384 Reply

    Done

    ImageManipulationElement.php:292 Reply

    Done

    DatabaseRowDefaultValues.php:56 Reply

    Done

    DatabaseRowDefaultValues.php:62 Reply

    Done

    TcaColumnsProcessFieldLabels.php:88 Reply

    Is that value ever going to contain a falsy value? If it's set to false or 0, then the behavior would be slightly different, but that would cast to a string anyway later on, no?

    TcaInline.php:113 Reply

    Untrue. See above.

    TcaInline.php:465 Reply

    Done

    TcaInlineExpandCollapseState.php:70 Reply

    Done

    RouteDispatcher.php:144 Reply

    Done

    FileStorageTreeProvider.php:284 Reply

    Done

    BackendUtility.php:236 Reply

    It will, but all of its contents will still check deeper values anyway so it reduces it to a noop. So I'd say just remove the if-check there and let the deep checks do their thing. If $GLOBALS['TCA'][$table]['ctrl'] is set but not to an array, the input data is bad and there's only so much we can do to protect against that when arbitrary user arrays are used. Which... suggests to me that line 228 needs a ?? [] on it, actually. (And then if someone sets it to a non-array value explicitly, that's just wrong and the code *should* blow up and tell them that.) As a general rule, "ensure sane defaults are in place" is a better strategy than "individually check to see if we need to use a default." That's why in several places I pre-set an array of defaults rather than sprinkling default checks elsewhere. That wasn't always feasible but I tried to do it where I could derive defaults from the local context.

    BackendUtility.php:2428 Reply

    It's just following the docblock already. Is the docblock incorrect? (If so, that needs to be changed.) I updated types in a few places to help flush out other PHP 8 compat issues. (And this is expected to go into 11 only, I think Benni said, so a minor change like that is OK.)

    BackendUtility.php:3450 Reply Unresolved

    I... don't rightly recall why I changed that. Probably to support some other code that called it and died with false. :-/ I'll have to see what that was.

    ArrayBrowser.php:109 Reply

    Done

    BackendLayoutView.php:188 Reply

    Done

    PageLayoutContext.php:117 Reply

    Done

    BackendUserAuthentication.php:81 Reply

    Oh goodie. How do we avoid a race on this? I would argue that having sane defaults pre-defined is the superior solution in most cases, so I don't know why we'd remove a sane default.

    BackendUserAuthentication.php:1246 Reply

    Disagree. Again, sane, type-safe defaults generally simplify code and avoid null issues. This is what you have to do when dealing with anonymous structs.

    SimpleFileBackend.php:292 Reply

    If anything, I'd remove the supression on unlink(). It was there, presumably, to avoid throwing a warning if the file doesn't exist, a trick that apparently no longer works in PHP 8. If the process fails for some reason other than "the file wasn't there", then that's a for-reals warning the admin should know about, like the file system being buggy. With the file_exists() check in place, I'd call the @ there vestigial and we should remove it.

    ReferenceIndex.php:312 Reply

    No impact in this case. The value is compared against a finite set of strings, so whether it's '' or 0 or boolean false it will still fail all of the switch checks the same way, and the switch arms do not use that value.

    FileSearchQuery.php:102 Reply

    If it's defined, can we not rely on it being set to a sane value? If someone manually sets it to false or 0 or such, that wouldn't work anyway.

    SearchTermRestriction.php:91 Reply

    Done

    ExtendedTemplateService.php:922 Reply

    Done

    MathUtility.php:32 Reply

    As above, following the existing docblock for v11 only.

    FileListController.php:395 Reply

    Done

    FileListController.php:475 Reply

    Done

    FileListController.php:849 Reply

    Done

    ConfigurationController.php:93 Reply

    Done

    DatabaseIntegrityCheck.php:360 Reply

    Done

    RecordListController.php:160 Reply

    Done

    DatabaseRecordList.php:836 Reply

    Incorrect, as above.

    DatabaseRecordList.php:845 Reply

    Done

    DatabaseRecordList.php:1060 Reply

    Done

    DatabaseRecordList.php:3268 Reply

    Incorrect, as above.

    SchedulerModuleController.php:241 Reply

    Isn't uid sometimes a string anyway?

    SetupModuleController.php:247 Reply

    Done

    TypoScriptTemplateConstantEditorModuleFunctionController.php:136 Reply

    Done

    TypoScriptTemplateInformationModuleFunctionController.php:150 Reply

    Done
  41. core-ci voted on patch set 14 V -1 05/11/21, 21:27 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11412

  42. Markus Klein commented on patch set 14 05/12/21, 06:35

    TranslationConfigurationProvider.php:192 Reply

    Your test was wrong: see https://3v4l.org/D27EL
  43. Oli Bartsch commented on patch set 14 05/12/21, 09:28

    TranslationConfigurationProvider.php:192 Reply

    Thanks Markus, was just about to make the same adjustments to the test. The Problem is, you only cover the outer array access but this does not include the inner $GLOBALS['TCA'][$table]['ctrl']['languageField'].

    TreeController.php:164 Reply

    In L:160 $this->expandedState is set to mixed (according to the corresponding PHPDoc). If this returns no object, in L:164 there is now the array access with null coalescing, which will assign any value, even empty (e.g. empty string), as soon as "stateHash" exists and is not null . Previously the value got also not assigned if empty. See: https://3v4l.org/14DgZ

    InlineControlContainer.php:308 Reply

    All right, I'm fine with this.

    InlineControlContainer.php:353 Reply

    Ack

    TcaColumnsProcessFieldLabels.php:88 Reply

    You're right, it actually doesn't matter since it's directly checked against empty in L:90. However, the assigned value differs, see: https://3v4l.org/2J46l. Just wanted to point out that it's important to prevent changes in behaviour, especially when dealing with TCA and FormEngine, since this is certainly the most used API by 3rd party code and people do a lot of wired stuff there, that we didn't even think of. :)

    TcaInline.php:113 Reply

    Please check the example from Markus.

    BackendUtility.php:236 Reply

    > It will, but all of its contents will still check deeper values anyway so it reduces it to a noop. So I'd say just remove the if-check there and let the deep checks do their thing. ACK > suggests to me that line 228 needs a ?? [] on it, actually Yes, that would be goo. > As a general rule, "ensure sane defaults are in place" is a better strategy than "individually check to see if we need to use a default." That's why in several places I pre-set an array of defaults rather than sprinkling default checks elsewhere. That wasn't always feasible but I tried to do it where I could derive defaults from the local context. ACK

    BackendUtility.php:2428 Reply

    Ok, so Benni must to approve this. From my point of view, we can not change type hints of public methods since this will surely break 100+ 3rd party installations with TypeErrors. The Docblock is correct, however it wasn't required to pass the annotated types, therefore people surely didn't add the required type checks before passing to this method. This is a common problem in our code base. Have a look at L:2434 where we actually check $menuItems for an array, even if stated in the docblock.

    BackendUserAuthentication.php:81 Reply

    The mentioned patch removes the default, since it is set to an empty array which is just wrong. Adding sane defaults sounds like a good idea in general. If we do so, we have to check the consuming code for places which currently just check for the array keys being set instead of checking the value. This would otherwise may change behaviour.

    BackendUserAuthentication.php:1246 Reply

    Ack

    SimpleFileBackend.php:292 Reply

    Yes ACK, let's remove the @ from unlink then.

    ReferenceIndex.php:312 Reply

    ACK

    FileSearchQuery.php:102 Reply

    People do funny things in TCA. There might be a reason why someone sets "sortby" to an empty string on purpose. This perviously led to "default_sortby" being assigned. Now, it will assign the empty string to $orderBy, see https://3v4l.org/MHsh7. So this is a change of behaviour, especially because there are six more places doing it the "old" way (e.g. TYPO3\CMS\Backend\Search\LiveSearch\LiveSearch, TYPO3\CMS\Backend\View\BackendLayout\ContentFetcher, ..). Missed this yesterday, we have to check ['default_sortby'] for existence, too. Otherwise this would also lead to undefined array key notice/warning if not defined.

    MathUtility.php:32 Reply

    This is legacy code. For sure, there is 3rd party code passing those values as string. Simply because this works due to the implicit type cast (https://3v4l.org/gaDqY). We can only deprecate such behaviour now and add the type hints in v12. Otherwise Benni must approve.

    DatabaseRecordList.php:836 Reply

    Please check the example from Markus.

    DatabaseRecordList.php:3268 Reply

    Please check the example from Markus.

    SchedulerModuleController.php:241 Reply

    Sorry, don't get this. Why should uid be a string? Are you referring to the NEW string when creating new records? This isn't the case here. Actually there are a couple of places in the class which rely on ['uid'] being an int.
  44. Benni Mack commented on patch set 14 05/12/21, 13:22

    MathUtility.php:32 Reply

    Please don't add any types to arguments if there are other ways to solve this (by casting directly at the beginning of the method e.g. "$field = (string)$field;"
  45. Oli Bartsch commented on patch set 14 05/12/21, 16:19

    TreeController.php:164 Reply

    Oke, looked at it again. As you already mentioned in slack, there should first of all be a local variable, which gets the user settings assigned. This could look like: 
$backendUserPageTreeState = GeneralUtility::makeInstance(BackendUserConfiguration::class)->get('BackendComponents.States.Pagetree'); When further looking at the usages of $this->expandedState, it’s clear, this must be an array in any case. L:358 (isset($this->expandedState[$identifier]) && $this->expandedState[$identifier]) To ensure an array gets assigned, I propose something like: } else { $stateHash = $this->expandedState['stateHash'] ?? null; $this->expandedState = is_array($stateHash) ? $stateHash : []; } I know, this would still be a change in behaviour, but after investigating the code in more detail, the current state seems to be wrong anyways. It makes no sense to assign any other type than array here.
  46. crell uploaded patch set 15 05/12/21, 17:27

  47. crell commented on patch set 15 05/12/21, 17:39

    Next round. Let's see if the bot is still cranky.

    TranslationConfigurationProvider.php:192 Reply

    Ugh. I hate arrays. Have I mentioned how I hate arrays? I really hate arrays...

    TreeController.php:164 Reply

    Done

    TcaColumnsProcessFieldLabels.php:88 Reply

    Changed to `($aPalettesArray[1] ?? null) ?: null`, which hurts me a little inside but I think is the most accurate representation of the previous behavior.

    TcaInline.php:113 Reply

    Done

    BackendUtility.php:236 Reply

    Done

    BackendUtility.php:2428 Reply

    Done

    BackendUserAuthentication.php:81 Reply

    I checked through the rest of the file, and every use of allowed_languages seems safe to me, with a '' default set.

    SimpleFileBackend.php:292 Reply

    Done

    FileSearchQuery.php:102 Reply

    Done

    FileSearchQuery.php:102 Reply

    Done

    MathUtility.php:32 Reply

    Done

    DatabaseRecordList.php:836 Reply

    Done

    DatabaseRecordList.php:3268 Reply

    Done

    SchedulerModuleController.php:241 Reply

    Done

    SchedulerModuleController.php:241 Reply

    Done
  48. core-ci voted on patch set 15 V -1 05/12/21, 17:56 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11453

  49. Oli Bartsch commented on patch set 15 05/12/21, 18:33

    TranslationConfigurationProvider.php:192 Reply

    Yeah, that's TYPO3 ^^

    SingleFieldContainer.php:85 Reply

    Done

    BackendUtility.php:235 Reply

    Done

    BackendUserAuthentication.php:81 Reply Unresolved

    Found one occurrence which is a bit tricky. https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php#L686 calls $this->check() with 'allowed_languages' as $type. The function body of check() is as following: > return isset($this->groupData[$type]) > && ($this->isAdmin() || GeneralUtility::inList($this->groupData[$type], $value)); So prior to this patch this directly returned FALSE in case the array key (the $type) does not exists in $groupData. With this patch, the key always exists and the first check is therefore always true. So it will now be sufficient to only be an admin to "pass" the check.
  50. crell uploaded patch set 16 05/12/21, 19:07

  51. core-ci voted on patch set 16 V +1 05/12/21, 19:21 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11457

  52. Benni Mack updated the commit message in patch set 17 05/12/21, 20:17

  53. core-ci voted on patch set 17 V +1 05/12/21, 20:26 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11459

  1. Susi Moog commented on patch set 17 V +1 05/13/21, 07:50

    I'm sure I didn't test every possible scenario, but I applied the patch while writing my latest blog post, so I basically tested through real-life usage: - Clipboard (single/multi mode) / List Module - Creating new pages and content - Preview - File Upload, Renaming, Selection - Scheduler Run - Import/Export with Relations (all on PHP 7.4, only ensuring that nothing breaks there). Gonna give a +1 Verified here :)
  2. Andreas Kienast commented on patch set 17 V -1 05/13/21, 10:40

    There are some places left, on it
  3. Andreas Kienast uploaded patch set 18 05/13/21, 11:50

  4. core-ci voted on patch set 18 V -1 05/13/21, 12:02 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11476

  5. Andreas Kienast commented on patch set 18 05/14/21, 05:15

    Comparator.php:64 Unresolved

    This method is flawed and does not what its name claims to do. Please see https://review.typo3.org/c/Packages/TYPO3.CMS/+/69143.
  6. Oli Bartsch commented on patch set 18 CR -1 05/14/21, 10:21

    On it.

    NewContentElementController.php:383

    This will potentially lead to a TypeError now, in case this is not an array.

    NewContentElementController.php:416

    Suggest to just proceed with the is_array check here.

    EditDocumentController.php:470

    $this->docHanlder is defined as array. Therefore we can not assign null here.

    EditDocumentController.php:826

    We still have to ensure this key is set

    InlineControlContainer.php:250

    Would still fail in case the $globalPointerField is not a key within $row.

    FormResultCompiler.php:191

    This changes behaviour AFAICS. Now this only is true in case $this->requireJsModules['TYPO3/CMS/Backend/FormEngine'] is already set.

    FormEngineUtility.php:162

    In case the key does not exists, nothing is assigned to $newElementValue at all. Previously this would've still assigned $itemValue in the else part.

    BackendUtility.php:1233

    Would still fail in case $GLOBALS['TCA'][$table]['ctrl']['descriptionColumn'] is not defined in $row.

    BackendUtility.php:1255

    Would still fail in case $ctrl['starttime'] is not defined in $row.

    BackendUtility.php:1388

    Would still fail in case label is not defined.

    BackendUtility.php:2894

    Would still fail in case username is not defined.

    GridColumnItem.php:67

    Would still fail in case t3ver_state is not defined.

    GridColumnItem.php:295

    Previously if this was set to 0, uid would have been taken. This is not not longer the case.

    GridColumnItem.php:295

    Would still fail in case uid is not defined.

    BackendLayoutView.php:445

    This can also return FALSE. See BackendUtility::workspaceOL().

    ReferenceIndex.php:536

    Would still fail in case 'type' is not set.

    DatabaseRecordList.php:657

    Typecast missing
  7. Oli Bartsch uploaded patch set 19 05/14/21, 10:26

  8. core-ci voted on patch set 19 V -1 05/14/21, 10:37 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11503

  9. Oli Bartsch uploaded patch set 20 05/14/21, 10:48

  10. Oli Bartsch commented on patch set 20 05/14/21, 10:48

    NewContentElementController.php:383 Reply

    Done

    NewContentElementController.php:416 Reply

    Done

    EditDocumentController.php:470 Reply

    Done

    EditDocumentController.php:826 Reply

    Done

    InlineControlContainer.php:250 Reply

    Done

    FormResultCompiler.php:191 Reply

    Done

    FormEngineUtility.php:162 Reply

    Done

    BackendUtility.php:1233 Reply

    Done

    BackendUtility.php:1255 Reply

    Done

    BackendUtility.php:1388 Reply

    Done

    BackendUtility.php:2894 Reply

    Done

    GridColumnItem.php:67 Reply

    Done

    GridColumnItem.php:295 Reply

    Done

    GridColumnItem.php:295 Reply

    Done

    BackendLayoutView.php:445 Reply

    Done

    ReferenceIndex.php:536 Reply

    Done

    DatabaseRecordList.php:657 Reply

    Done
  11. core-ci voted on patch set 20 V +1 05/14/21, 10:58 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11505

  12. Andreas Kienast uploaded patch set 21 05/14/21, 11:28

  13. Andreas Kienast commented on patch set 21 05/14/21, 11:29

    Comparator.php:64 Unresolved

    I talked with Oli about this. We'll get https://review.typo3.org/c/Packages/TYPO3.CMS/+/69143 merged at first and then rebase this patch.
  14. core-ci voted on patch set 21 V -1 05/14/21, 11:38 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11507

  15. Oli Bartsch rebased onto patch set 22 05/14/21, 12:52

  16. core-ci voted on patch set 22 V -1 05/14/21, 13:01 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11512

  17. Andreas Kienast uploaded patch set 23 05/14/21, 13:13

  18. core-ci voted on patch set 23 V +1 05/14/21, 13:22 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11514

  19. Andreas Kienast voted on patch set 23 V +1 CR +1 05/14/21, 13:23

  20. Oli Bartsch voted on patch set 23 V +1 CR +1 05/14/21, 13:33

  21. Benni Mack voted on patch set 23 V +2 CR +2 05/14/21, 13:52

  22. Benni Mack commented on patch set 23 05/14/21, 13:57

    Let's get this in and see what is left then.
  23. Benni Mack merged patch set 24 05/14/21, 13:58

  24. Oli Bartsch commented on patch set 24 06/10/21, 14:40

    RecordListController.php:160 Unresolved

    Introduces a regression https://forge.typo3.org/issues/94301. Clipboard can not longer be turned of via the checkbox in recordlist, since it will always be set to TRUE in case $this->modTSconfig['enableClipBoard'] is not set to 'deactivated'. However "activated" and "deactivated" are not the only values for this option. Therefore, this check can not be shortened.
  25. Christian Kuhn commented on patch set 24 11/19/21, 15:41

    DataHandler.php:4356 Unresolved

    That's not a good idea. Never change globals TCA. Sanitize calls instead.