70741[BUGFIX] PHP 8 warnings: Undefined array key in EXT:impexp
Commit message
Review
-
Code review CR +2 Done
- Oli Bartsch +2
- Jochen Roth +1
-
Verified V +2 Done
- Oli Bartsch +2
- Jochen Roth +1
- core-ci +1 CI
Issues 1
Files 15
- typo3/sysext/impexp/Classes/View/ExportPageTreeView.php4+2 −1
- typo3/sysext/impexp/Classes/Export.php3+6 −6
- typo3/sysext/impexp/Classes/Import.php2+11 −9
- typo3/sysext/impexp/Classes/ImportExport.php10+21 −17
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecords.php+24 −0
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportPageAndRecordsWithSoftRefs.php+16 −0
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportRecords.php+6 −1
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewExportTable.php+9 −3
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecords.php+12 −4
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdate.php+8 −2
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php+28 −3
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsWithDiff.php+28 −3
- typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsWithSoftRefs.php+6 −0
- typo3/sysext/impexp/Tests/Functional/ExportTest.php+6 −5
- typo3/sysext/impexp/Tests/Functional/ImportTest.php2+37 −1
Review log 2533
Show 48 earlier messages
-
Alexander Nitsche uploaded patch set 1 08/24/21, 15:43
-
core-ci voted on patch set 1 V +1 08/24/21, 16:02 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15521
-
Alexander Nitsche uploaded patch set 2 08/24/21, 20:55
-
core-ci voted on patch set 2 V -1 08/24/21, 21:25 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15537
-
Alexander Nitsche uploaded patch set 3 08/25/21, 10:49
-
core-ci voted on patch set 3 V -1 08/25/21, 10:53 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15580
-
Alexander Nitsche uploaded patch set 4 08/25/21, 11:13
-
core-ci voted on patch set 4 V +1 08/25/21, 11:35 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15581
-
Alexander Nitsche updated the commit message in patch set 5 08/25/21, 12:34
-
core-ci voted on patch set 5 V +1 08/25/21, 12:57 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15589
-
Alexander Nitsche commented on patch set 5 08/25/21, 13:10
All changes are covered by existing functional tests. This patch is mainly about adding all sorts of `??` to array field accesses and to extend the testing fixtures by some new default array fields. Furthermore the code lines which print the fixture files on demand are added to ImportTest.php class similar to ExportTest.php. -
Christian Kuhn commented on patch set 5 08/26/21, 05:07
that's weird. those warnings should trigger functional fail. i mean, we had tons of php8 related warnings that we fixed due to functional fails. did we (I?) somehow managed to fuck the functional setup up in this regard lately? or does the impexp extension fiddle with log setup, or has a central place where generic exceptions are caught or something like that? should be investigated, but does not affect this patch directly. -
Alexander Nitsche commented on patch set 5 08/26/21, 13:47
Reply
Good question .. i did not actively change the logging behaviour but .. for the time being i will watch the logs manually (script command ready :) and have a look into the logging after the next patch (#95007). Maybe the recent changes in the logging area have an impact here. -
Jochen Roth uploaded patch set 6 09/06/21, 07:27
-
core-ci voted on patch set 6 V +1 09/06/21, 07:45 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16305
-
Alexander Nitsche commented on patch set 6 09/06/21, 07:55
ImportExport.php:898I would test for the full `$softref['subst']['tokenID']` here as is used one line below. -
Jochen Roth uploaded patch set 7 09/06/21, 08:16
-
Jochen Roth commented on patch set 7 09/06/21, 08:18
ImportExport.php:898ReplyAck -
core-ci voted on patch set 7 V +1 09/06/21, 08:34 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16308
-
Alexander Nitsche commented on patch set 7 V +1 CR +1 09/06/21, 09:01
No "Undefined array key .." appearing in EXT:impexp functional tests run with ``` ./Build/Scripts/runTests.sh -s functional -d mariadb -p 8.0 -e "-v typo3/sysext/impexp/Tests/Functional" find typo3temp/var/tests/**/typo3temp/var/log -name "*.log" -exec cat {} \; ``` -
Jochen Roth voted on patch set 7 V +1 CR +1 09/10/21, 08:23
-
Jochen Roth wrote 09/10/21, 08:30
Removed Verified+1 by Jochen <rothjochen@gmail.com> -
Jochen Roth wrote 09/10/21, 08:30
Removed Code-Review+1 by Jochen <rothjochen@gmail.com> -
Jochen Roth voted on patch set 7 V +1 CR +1 09/10/21, 08:35
-
Oli Bartsch commented on patch set 7 09/10/21, 09:45
Export.php:1180Shouldn't this be skipped if not set? Or do we rely on this being serialized as NULL?Import.php:727Isn't this change of behaviour? Previously if this was not set, $this->pid was used. Now, the assignment "$this->addSingle($importData, 'pages', (int)$pageUid, $pid)" as well as the "unset($remainingPages[$pageUid]);" is completely skipped.ImportExport.php:742Might be changed to "false", making the intention clear.ImportExport.php:778Let's change this to "false"ImportExport.php:898This if/else could simply be done like this: $mode = $this->softrefCfg[$softref['subst']['tokenID'] ?? null]['mode'] ?? '';ImportExport.php:998Let's just use $cfg['title'] ?? false here. This implicit checks for "not empty".ExportPageTreeView.php:183Looks like the initial intention was to check for "not empty", right? -
crell commented on patch set 7 09/10/21, 13:34
Otherwise I agree with Oliver's comments here. Thanks!Export.php:1180ReplyThe change here most accurately mimics what the behavior was in 7.4. Whether or not that's actually the desired behavior is another question. My gut feeling is that it probably should be skipped, which could be done either with a wrapping if (isset()) or with a ternary with empty string default. I also wonder if the other keys here might sometimes be empty. (This is why array pseudo-structures are so not nice. 😊 )ExportPageTreeView.php:183ReplyI think in other similar places we ended up doing: $pageTreeState = ($pageTreeState['stateHash'] ?? []) ?: []; Although that is highly ugly and a sign that something else is wrong. It is the most compact way to maintain the current logic.ImportTest.php:101Why is this added but commented out immediately? I don't follow. -
Alexander Nitsche commented on patch set 7 09/10/21, 18:08
Thanks for your extensive feedback. I incorporated most of it.Export.php:1180ReplyI would like to move changes in logic into a separate patch and handle only those PHP 8 array key warnings in this one.Import.php:727ReplyAckImportExport.php:742ReplyAckImportExport.php:778ReplyAckImportExport.php:898ReplyAckImportExport.php:998ReplyAckExportPageTreeView.php:183ReplyThis is to align with the TreeController implementation at https://github.com/TYPO3/typo3/blob/master/typo3/sysext/backend/Classes/Controller/Page/TreeController.php#L164 .ImportTest.php:101ReplyThis is to facilitate updating fixtures. If the implementation changes, comment out these lines, run the test which updates the fixture, and comment those lines in again. -
Alexander Nitsche uploaded patch set 8 09/10/21, 18:10
-
core-ci voted on patch set 8 V +1 09/10/21, 18:26 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16509
-
Jochen Roth voted on patch set 8 V +1 CR +1 09/13/21, 11:44
-
Oli Bartsch commented on patch set 8 V +1 CR +1 09/13/21, 11:45
ExportPageTreeView.php:183ReplyAck -
Oli Bartsch voted on patch set 8 V +2 CR +2 09/13/21, 13:01
-
Oli Bartsch merged patch set 9 09/13/21, 13:01