69012[BUGFIX] Resolve PHP 8 issues in acceptance tests
Commit message
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
- typo3/sysext/backend/Classes/Clipboard/Clipboard.php8+23 −19
- typo3/sysext/backend/Classes/Configuration/TranslationConfigurationProvider.php6+2 −2
- typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php10+9 −7
- typo3/sysext/backend/Classes/Controller/Page/TreeController.php7+6 −5
- typo3/sysext/backend/Classes/Controller/BackendController.php+1 −1
- typo3/sysext/backend/Classes/Controller/EditDocumentController.php4+10 −10
- typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php+3 −3
- typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php+4 −4
- typo3/sysext/backend/Classes/Form/Container/FlexFormNoTabsContainer.php+1 −1
- typo3/sysext/backend/Classes/Form/Container/FlexFormTabsContainer.php+3 −3
- typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php12+25 −19
- typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php+1 −1
- typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php2+15 −21
- typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php+1 −1
- typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php+2 −2
- typo3/sysext/backend/Classes/Form/Element/CheckboxLabeledToggleElement.php+2 −2
- typo3/sysext/backend/Classes/Form/Element/CheckboxToggleElement.php+4 −3
- typo3/sysext/backend/Classes/Form/Element/GroupElement.php+1 −1
- typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php2+1 −3
- typo3/sysext/backend/Classes/Form/Element/InputColorPickerElement.php+4 −4
Show 71 more files
- typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php+1 −1
- typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php+5 −5
- typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php+1 −1
- typo3/sysext/backend/Classes/Form/Element/InputTextElement.php+4 −4
- typo3/sysext/backend/Classes/Form/Element/NoneElement.php+3 −3
- typo3/sysext/backend/Classes/Form/Element/RadioElement.php+1 −1
- typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php+3 −3
- typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php+4 −4
- typo3/sysext/backend/Classes/Form/Element/SelectSingleBoxElement.php+2 −2
- typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php+2 −2
- typo3/sysext/backend/Classes/Form/Element/TextElement.php+6 −6
- typo3/sysext/backend/Classes/Form/Element/TextTableElement.php+5 −5
- typo3/sysext/backend/Classes/Form/FieldControl/ElementBrowser.php+7 −5
- typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php+1 −1
- typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDefaultValues.php4+2 −2
- typo3/sysext/backend/Classes/Form/FormDataProvider/SiteTcaInline.php+4 −4
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaCheckboxItems.php+2 −2
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessFieldLabels.php6+1 −1
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php+4 −4
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInline.php8+4 −4
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInlineExpandCollapseState.php2+1 −1
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectTreeItems.php+2 −2
- typo3/sysext/backend/Classes/Form/AbstractNode.php+1 −1
- typo3/sysext/backend/Classes/Http/RouteDispatcher.php2+3 −2
- typo3/sysext/backend/Classes/Middleware/BackendUserAuthenticator.php+1 −1
- typo3/sysext/backend/Classes/Template/Components/Buttons/SplitButton.php+1 −1
- typo3/sysext/backend/Classes/Tree/FileStorageTreeProvider.php2+1 −1
- typo3/sysext/backend/Classes/Utility/BackendUtility.php20+75 −66
- typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php6+2 −2
- typo3/sysext/backend/Classes/View/ArrayBrowser.php2+1 −1
- typo3/sysext/backend/Classes/View/BackendLayoutView.php4+2 −2
- typo3/sysext/backend/Classes/View/PageLayoutContext.php2+2 −2
- typo3/sysext/beuser/Classes/Service/UserInformationService.php+2 −1
- typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php8+21 −3
- typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php6+5 −1
- typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php+1 −1
- typo3/sysext/core/Classes/Database/Schema/Comparator.php7+2 −1
- typo3/sysext/core/Classes/Database/ReferenceIndex.php5+2 −2
- typo3/sysext/core/Classes/Database/RelationHandler.php4+15 −6
- typo3/sysext/core/Classes/DataHandling/DataHandler.php1+18 −3
- typo3/sysext/core/Classes/Error/DebugExceptionHandler.php+1 −1
- typo3/sysext/core/Classes/Error/ErrorHandler.php+1 −1
- typo3/sysext/core/Classes/Imaging/IconFactory.php+8 −8
- typo3/sysext/core/Classes/Localization/LanguageService.php+7 −2
- typo3/sysext/core/Classes/Page/PageRenderer.php+1 −1
- typo3/sysext/core/Classes/Resource/Search/QueryRestrictions/SearchTermRestriction.php2+1 −1
- typo3/sysext/core/Classes/Resource/Search/FileSearchQuery.php5+1 −1
- typo3/sysext/core/Classes/Resource/ProcessedFile.php+3 −3
- typo3/sysext/core/Classes/Tree/TableConfiguration/AbstractTableConfigurationTreeDataProvider.php+1 −1
- typo3/sysext/core/Classes/Tree/TableConfiguration/DatabaseTreeDataProvider.php+3 −3
- typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php+1 −1
- typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php2+1 −1
- typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php+1 −1
- typo3/sysext/core/Classes/Utility/GeneralUtility.php+5 −2
- typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php+1 −1
- typo3/sysext/extensionmanager/Classes/ViewHelpers/ToggleExtensionInstallationStateViewHelper.php+3 −0
- typo3/sysext/filelist/Classes/Controller/FileListController.php8+10 −10
- typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php2+1 −1
- typo3/sysext/install/Classes/Middleware/Maintenance.php+1 −1
- typo3/sysext/lowlevel/Classes/Controller/ConfigurationController.php2+2 −2
- typo3/sysext/lowlevel/Classes/Integrity/DatabaseIntegrityCheck.php2+2 −2
- typo3/sysext/recordlist/Classes/Controller/RecordListController.php3+12 −18
- typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php14+66 −65
- typo3/sysext/redirects/Classes/Repository/Demand.php+1 −1
- typo3/sysext/rte_ckeditor/Classes/Form/Resolver/RichTextNodeResolver.php+1 −1
- typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php5+1 −1
- typo3/sysext/setup/Classes/Controller/SetupModuleController.php2+12 −14
- typo3/sysext/sys_note/Classes/Hook/ButtonBarHook.php+1 −1
- typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php2+1 −1
- typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php2+1 −1
- typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php+3 −3
Review log 5578
Show 3653 earlier messages
-
crell uploaded patch set 1 05/04/21, 15:55
-
Christian Kuhn commented on patch set 1 05/04/21, 15:59
-
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
-
crell uploaded patch set 2 05/04/21, 21:37
-
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
-
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 -
crell uploaded patch set 3 05/05/21, 19:33
-
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
-
crell uploaded patch set 4 05/05/21, 22:21
-
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
-
Tymoteusz Motylewski commented on patch set 4 05/06/21, 05:37
TcaColumnsProcessFieldLabels.php:88in case of the empty string, this will change behaviour, right? i havent dig into it to say whether its ok or not. -
Markus Klein commented on patch set 4 05/06/21, 07:53
ConditionMatcher.php:45Are you ignoring $rootLine now on purpose? -
Markus Klein commented on patch set 4 05/06/21, 08:39
Clipboard.php:127must be !empty() -
Christian Kuhn commented on patch set 4 05/06/21, 12:35
Reply
fixing in styleguide now. -
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 466RelationHandler.php:253Argument 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:1060Space after equalsComparator.php:64Remove var_dump()Comparator.php:64Remove var_dump()FileListController.php:352Causes 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); -
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:127ReplyAckTcaColumnsProcessFieldLabels.php:88Reply UnresolvedNominally 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:466ReplyAckRelationHandler.php:253ReplyGross. :-) Updating the docblock accordingly.RelationHandler.php:1060ReplyDoneComparator.php:64ReplyForgot 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:64ReplyDoneFileListController.php:352ReplyAckConditionMatcher.php:45ReplyAh, nope. That's my error. Good catch. Fixed. -
crell uploaded patch set 5 05/06/21, 22:08
-
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. -
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
-
Jochen Roth commented on patch set 5 05/07/21, 09:31
Comparator.php:64Reply UnresolvedSorry, can't reproduce this. -
crell uploaded patch set 6 05/07/21, 20:25
-
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
-
crell uploaded patch set 7 05/07/21, 20:35
-
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
-
crell uploaded patch set 8 05/07/21, 21: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
-
crell uploaded patch set 9 05/07/21, 22:27
-
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
-
crell uploaded patch set 10 05/10/21, 15:58
-
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
-
crell uploaded patch set 11 05/10/21, 16:38
-
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
-
Richard Haeser uploaded patch set 12 05/10/21, 19:35
-
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
-
Richard Haeser uploaded patch set 13 05/10/21, 20:04
-
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:293ReplyDone -
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
-
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:130Change in behaviour. Previously checked for array. Now only check for existence of the key.Clipboard.php:132Change in behaviour. Previously checked for array. Now only check for existence of the key.Clipboard.php:164Change 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:192Would still lead to Undefined array key warning in case `$GLOBALS['TCA'][$table]['ctrl']['languageField']` is not defined.NewContentElementController.php:382Change in behaviour. Previously checked for array. Now only check for existence of the key.NewContentElementController.php:415Change 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:441Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.TreeController.php:164Change 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:406Change in behaviour. Previously the assigned value was always casted to int, but can now be anything.InlineControlContainer.php:269null 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:308When using strict, I would suggest to apply the necessary type to the needle: (string)($config['appearance']['levelLinksPosition'] ?? '').InlineControlContainer.php:353When using strict, I would suggest to apply the necessary type to the needle: (string)($config['appearance']['levelLinksPosition'] ?? '').InlineControlContainer.php:384Change 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:85Change in behaviour. Previously checked for array, now always assigned, even if value is not an array.ImageManipulationElement.php:292is_null will raise an undefined array key warning, in case the key does not exist.DatabaseRowDefaultValues.php:56Typecast to string should IMO still be applied here.DatabaseRowDefaultValues.php:62Typecast to string should IMO still be applied here.TcaColumnsProcessFieldLabels.php:88Change 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:113Would still lead to Undefined array key warning in case `$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']` is not defined.TcaInline.php:465Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.TcaInlineExpandCollapseState.php:70Would suggest to use '' or null here.RouteDispatcher.php:144Let'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:284Change 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:235This will fail with a TypeError in case $ctrl is no array.BackendUtility.php:236Why do we add the array here? The below if clause will then always be true.BackendUtility.php:2428This is a breaking change, since the method is not marked as internal.BackendUtility.php:3450This 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:109Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.BackendLayoutView.php:188Change in behaviour. Previously the assigned value was always casted to string, but can now be anything.PageLayoutContext.php:117Change in behaviour. Previously the assigned value was always casted to integer, but can now be anything.BackendUserAuthentication.php:81There is another patch where we want to get rid this, see: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68795.BackendUserAuthentication.php:1246I prefer using null coalescing below instead of filling the array with these default values.SimpleFileBackend.php:292Should we suppress warning for file_exists, too?ReferenceIndex.php:312Change in behaviour. Previously the checked value was always casted to string, but can now be anything.FileSearchQuery.php:102Change in behaviour. $GLOBALS['TCA'][self::FILES_TABLE]['ctrl']['sortby'] is now always assigned (as soon as the key exists), even if "empty".SearchTermRestriction.php:91This will now lead to a type error in case $fieldConfig['search'] is not an array and not null.ExtendedTemplateService.php:922Change in behaviour. Previously checked for array, now also true even if not an array but evaluated to !empty.MathUtility.php:32Breaking change, since this is public API.FileListController.php:395Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.FileListController.php:475Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.FileListController.php:849Change in behaviour. Previously the assigned value was always casted to bool, but can now be anything.ConfigurationController.php:93Will lead to TypeError in case $postValues['searchString'] is not a string and not null.DatabaseIntegrityCheck.php:360Would prefer using '' here since we compare to a string.RecordListController.php:160Will lead to notice/warning in case enableClipBoard is not defined.DatabaseRecordList.php:836Would still lead to Undefined array key warning in case `$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']` is not defined.DatabaseRecordList.php:845Will now lead to TypeError in case the value is not an integer.DatabaseRecordList.php:1060Change in behaviour. Will now also assigned, even if no array.DatabaseRecordList.php:3268Would still lead to Undefined array key warning in case `$GLOBALS['TCA'][$table]['ctrl']['languageField']` is not defined.SchedulerModuleController.php:241Change in behaviour. Previously the assigned value was always casted to int, but can now be anything.SetupModuleController.php:247Would prefer using '' here since we compare to a string.TypoScriptTemplateConstantEditorModuleFunctionController.php:136Change 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:150Change 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. -
crell uploaded patch set 14 05/11/21, 21:08
-
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:130ReplyDoneClipboard.php:132ReplyDoneClipboard.php:164ReplyDoneTranslationConfigurationProvider.php:192Reply3v4l says that's fine: https://3v4l.org/srU6DNewContentElementController.php:382ReplyDoneNewContentElementController.php:415ReplyDoneNewContentElementController.php:441ReplyDoneTreeController.php:164ReplyI 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:406ReplyDoneInlineControlContainer.php:269ReplyDoneInlineControlContainer.php:308ReplyDoes 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:353ReplyIbid.InlineControlContainer.php:384ReplyDoneImageManipulationElement.php:292ReplyDoneDatabaseRowDefaultValues.php:56ReplyDoneDatabaseRowDefaultValues.php:62ReplyDoneTcaColumnsProcessFieldLabels.php:88ReplyIs 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:113ReplyUntrue. See above.TcaInline.php:465ReplyDoneTcaInlineExpandCollapseState.php:70ReplyDoneRouteDispatcher.php:144ReplyDoneFileStorageTreeProvider.php:284ReplyDoneBackendUtility.php:236ReplyIt 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:2428ReplyIt'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:3450Reply UnresolvedI... 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:109ReplyDoneBackendLayoutView.php:188ReplyDonePageLayoutContext.php:117ReplyDoneBackendUserAuthentication.php:81ReplyOh 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:1246ReplyDisagree. 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:292ReplyIf 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:312ReplyNo 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:102ReplyIf 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:91ReplyDoneExtendedTemplateService.php:922ReplyDoneMathUtility.php:32ReplyAs above, following the existing docblock for v11 only.FileListController.php:395ReplyDoneFileListController.php:475ReplyDoneFileListController.php:849ReplyDoneConfigurationController.php:93ReplyDoneDatabaseIntegrityCheck.php:360ReplyDoneRecordListController.php:160ReplyDoneDatabaseRecordList.php:836ReplyIncorrect, as above.DatabaseRecordList.php:845ReplyDoneDatabaseRecordList.php:1060ReplyDoneDatabaseRecordList.php:3268ReplyIncorrect, as above.SchedulerModuleController.php:241ReplyIsn't uid sometimes a string anyway?SetupModuleController.php:247ReplyDoneTypoScriptTemplateConstantEditorModuleFunctionController.php:136ReplyDoneTypoScriptTemplateInformationModuleFunctionController.php:150ReplyDone -
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
-
Markus Klein commented on patch set 14 05/12/21, 06:35
TranslationConfigurationProvider.php:192ReplyYour test was wrong: see https://3v4l.org/D27EL -
Oli Bartsch commented on patch set 14 05/12/21, 09:28
TranslationConfigurationProvider.php:192ReplyThanks 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:164ReplyIn 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/14DgZInlineControlContainer.php:308ReplyAll right, I'm fine with this.InlineControlContainer.php:353ReplyAckTcaColumnsProcessFieldLabels.php:88ReplyYou'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:113ReplyPlease check the example from Markus.BackendUtility.php:236Reply> 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. ACKBackendUtility.php:2428ReplyOk, 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:81ReplyThe 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:1246ReplyAckSimpleFileBackend.php:292ReplyYes ACK, let's remove the @ from unlink then.ReferenceIndex.php:312ReplyACKFileSearchQuery.php:102ReplyPeople 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:32ReplyThis 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:836ReplyPlease check the example from Markus.DatabaseRecordList.php:3268ReplyPlease check the example from Markus.SchedulerModuleController.php:241ReplySorry, 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. -
Benni Mack commented on patch set 14 05/12/21, 13:22
MathUtility.php:32ReplyPlease 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;" -
Oli Bartsch commented on patch set 14 05/12/21, 16:19
TreeController.php:164ReplyOke, 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. -
crell uploaded patch set 15 05/12/21, 17:27
-
crell commented on patch set 15 05/12/21, 17:39
Next round. Let's see if the bot is still cranky.TranslationConfigurationProvider.php:192ReplyUgh. I hate arrays. Have I mentioned how I hate arrays? I really hate arrays...TreeController.php:164ReplyDoneTcaColumnsProcessFieldLabels.php:88ReplyChanged 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:113ReplyDoneBackendUtility.php:236ReplyDoneBackendUtility.php:2428ReplyDoneBackendUserAuthentication.php:81ReplyI checked through the rest of the file, and every use of allowed_languages seems safe to me, with a '' default set.SimpleFileBackend.php:292ReplyDoneFileSearchQuery.php:102ReplyDoneFileSearchQuery.php:102ReplyDoneMathUtility.php:32ReplyDoneDatabaseRecordList.php:836ReplyDoneDatabaseRecordList.php:3268ReplyDoneSchedulerModuleController.php:241ReplyDoneSchedulerModuleController.php:241ReplyDone -
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
-
Oli Bartsch commented on patch set 15 05/12/21, 18:33
TranslationConfigurationProvider.php:192ReplyYeah, that's TYPO3 ^^SingleFieldContainer.php:85ReplyDoneBackendUtility.php:235ReplyDoneBackendUserAuthentication.php:81Reply UnresolvedFound 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. -
crell uploaded patch set 16 05/12/21, 19:07
-
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
-
Benni Mack updated the commit message in patch set 17 05/12/21, 20:17
-
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
-
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 :) -
Andreas Kienast commented on patch set 17 V -1 05/13/21, 10:40
There are some places left, on it -
Andreas Kienast uploaded patch set 18 05/13/21, 11:50
-
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
-
Andreas Kienast commented on patch set 18 05/14/21, 05:15
Comparator.php:64UnresolvedThis method is flawed and does not what its name claims to do. Please see https://review.typo3.org/c/Packages/TYPO3.CMS/+/69143. -
Oli Bartsch commented on patch set 18 CR -1 05/14/21, 10:21
On it.NewContentElementController.php:383This will potentially lead to a TypeError now, in case this is not an array.NewContentElementController.php:416Suggest 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:826We still have to ensure this key is setInlineControlContainer.php:250Would still fail in case the $globalPointerField is not a key within $row.FormResultCompiler.php:191This changes behaviour AFAICS. Now this only is true in case $this->requireJsModules['TYPO3/CMS/Backend/FormEngine'] is already set.FormEngineUtility.php:162In 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:1233Would still fail in case $GLOBALS['TCA'][$table]['ctrl']['descriptionColumn'] is not defined in $row.BackendUtility.php:1255Would still fail in case $ctrl['starttime'] is not defined in $row.BackendUtility.php:1388Would still fail in case label is not defined.BackendUtility.php:2894Would still fail in case username is not defined.GridColumnItem.php:67Would still fail in case t3ver_state is not defined.GridColumnItem.php:295Previously if this was set to 0, uid would have been taken. This is not not longer the case.GridColumnItem.php:295Would still fail in case uid is not defined.BackendLayoutView.php:445This can also return FALSE. See BackendUtility::workspaceOL().ReferenceIndex.php:536Would still fail in case 'type' is not set.DatabaseRecordList.php:657Typecast missing -
Oli Bartsch uploaded patch set 19 05/14/21, 10:26
-
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
-
Oli Bartsch uploaded patch set 20 05/14/21, 10:48
-
Oli Bartsch commented on patch set 20 05/14/21, 10:48
NewContentElementController.php:383ReplyDoneNewContentElementController.php:416ReplyDoneEditDocumentController.php:470ReplyDoneEditDocumentController.php:826ReplyDoneInlineControlContainer.php:250ReplyDoneFormResultCompiler.php:191ReplyDoneFormEngineUtility.php:162ReplyDoneBackendUtility.php:1233ReplyDoneBackendUtility.php:1255ReplyDoneBackendUtility.php:1388ReplyDoneBackendUtility.php:2894ReplyDoneGridColumnItem.php:67ReplyDoneGridColumnItem.php:295ReplyDoneGridColumnItem.php:295ReplyDoneBackendLayoutView.php:445ReplyDoneReferenceIndex.php:536ReplyDoneDatabaseRecordList.php:657ReplyDone -
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
-
Andreas Kienast uploaded patch set 21 05/14/21, 11:28
-
Andreas Kienast commented on patch set 21 05/14/21, 11:29
Comparator.php:64UnresolvedI 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. -
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
-
Oli Bartsch rebased onto patch set 22 05/14/21, 12:52
-
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
-
Andreas Kienast uploaded patch set 23 05/14/21, 13:13
-
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
-
Andreas Kienast voted on patch set 23 V +1 CR +1 05/14/21, 13:23
-
Oli Bartsch voted on patch set 23 V +1 CR +1 05/14/21, 13:33
-
Benni Mack voted on patch set 23 V +2 CR +2 05/14/21, 13:52
-
Benni Mack commented on patch set 23 05/14/21, 13:57
Let's get this in and see what is left then. -
Benni Mack merged patch set 24 05/14/21, 13:58
-
Oli Bartsch commented on patch set 24 06/10/21, 14:40
RecordListController.php:160UnresolvedIntroduces 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. -
Christian Kuhn commented on patch set 24 11/19/21, 15:41
DataHandler.php:4356UnresolvedThat's not a good idea. Never change globals TCA. Sanitize calls instead.
SimpleFileBackend.php:293