69425[BUGFIX] Make logger usage PSR-3 compliant
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Anja Leichsenring +1
-
Verified V +2 Done
- Christian Kuhn +2
- Anja Leichsenring +1
- core-ci +1 CI
Issues 2
Files 54
- typo3/sysext/backend/Classes/Authentication/PasswordReset.php+7 −4
- typo3/sysext/backend/Classes/Controller/File/ImageProcessController.php+1 −1
- typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php+5 −6
- typo3/sysext/backend/Classes/Security/EmailLoginNotification.php5+7 −5
- typo3/sysext/backend/Classes/Utility/BackendUtility.php+6 −1
- typo3/sysext/backend/Classes/View/AuthenticationStyleInformation.php+6 −8
- typo3/sysext/backend/Classes/View/PageLayoutView.php+5 −6
- typo3/sysext/backend/Tests/Functional/Authentication/PasswordResetTest.php1+27 −6
- typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php+28 −15
- typo3/sysext/core/Classes/Authentication/AuthenticationService.php+11 −4
- typo3/sysext/core/Classes/Database/Connection.php2+2 −2
- typo3/sysext/core/Classes/Database/ReferenceIndex.php+5 −5
- typo3/sysext/core/Classes/DataHandling/DataHandler.php+1 −1
- typo3/sysext/core/Classes/Domain/Repository/PageRepository.php4+3 −4
- typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php5+38 −18
- typo3/sysext/core/Classes/Log/Writer/AbstractWriter.php4+56 −0
- typo3/sysext/core/Classes/Log/Writer/DatabaseWriter.php6+6 −7
- typo3/sysext/core/Classes/Log/Writer/FileWriter.php2+19 −31
- typo3/sysext/core/Classes/Log/Writer/PhpErrorLogWriter.php+11 −10
- typo3/sysext/core/Classes/Log/Writer/SyslogWriter.php+13 −12
Show 34 more files
- typo3/sysext/core/Classes/Log/LogManager.php+10 −2
- typo3/sysext/core/Classes/Mail/MemorySpool.php+1 −1
- typo3/sysext/core/Classes/Mail/TransportFactory.php+1 −1
- typo3/sysext/core/Classes/PageTitle/PageTitleProviderManager.php+12 −12
- typo3/sysext/core/Classes/Resource/Index/Indexer.php+5 −2
- typo3/sysext/core/Classes/Resource/ProcessedFileRepository.php+5 −6
- typo3/sysext/core/Classes/Resource/StorageRepository.php+2 −8
- typo3/sysext/core/Classes/Session/UserSessionManager.php+2 −2
- typo3/sysext/core/Classes/Type/File/ImageInfo.php+1 −1
- typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php+3 −1
- typo3/sysext/core/Classes/Utility/GeneralUtility.php4+9 −7
- typo3/sysext/core/Documentation/Changelog/master/Important-94315-UseProperPSR-3LoggingMessagesAndContext.rstnew+37 −0
- typo3/sysext/core/Tests/Unit/Error/DebugExceptionHandlerTest.php+19 −4
- typo3/sysext/core/Tests/Unit/Error/ProductionExceptionHandlerTest.php+17 −4
- typo3/sysext/extbase/Classes/Object/Container/Container.php+9 −3
- typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php+5 −8
- typo3/sysext/extbase/Tests/Unit/Object/Container/ContainerTest.php+27 −18
- typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php+7 −13
- typo3/sysext/felogin/Classes/Validation/RedirectUrlValidator.php+1 −1
- typo3/sysext/filelist/Classes/Controller/FileListController.php+4 −5
- typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php+2 −2
- typo3/sysext/frontend/Classes/ContentObject/Exception/ProductionExceptionHandler.php2+3 −6
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php+13 −7
- typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php1+11 −9
- typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php+1 −1
- typo3/sysext/frontend/Classes/Resource/FileCollector.php+10 −7
- typo3/sysext/install/Classes/Service/LanguagePackService.php2+5 −6
- typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php7+1 −3
- typo3/sysext/redirects/Classes/Service/RedirectService.php+3 −3
- typo3/sysext/scheduler/Classes/Example/TestTask.php+1 −1
- typo3/sysext/scheduler/Classes/Task/AbstractTask.php+14 −12
- typo3/sysext/scheduler/Classes/Scheduler.php+18 −9
- typo3/sysext/workspaces/Classes/Notification/StageChangeNotification.php+6 −5
- typo3/sysext/workspaces/Classes/Service/GridDataService.php+5 −1
Review log 5067
Show 2942 earlier messages
-
crell uploaded patch set 1 06/09/21, 22:38
-
crell marked it work in progress 06/09/21, 22:38
-
crell commented on patch set 1 06/09/21, 22:39
This change is ready for review.Still WIP, but I want to get it off my computer and see what parts of it the bot hates. Preliminary reviews welcome. -
crell marked it work in progress 06/09/21, 22:39
-
core-ci voted on patch set 1 V -1 06/09/21, 22:46 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12258
-
crell uploaded patch set 2 06/10/21, 16:09
-
core-ci voted on patch set 2 V -1 06/10/21, 16:11 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12277
-
crell uploaded patch set 3 06/10/21, 16:20
-
core-ci voted on patch set 3 V -1 06/10/21, 16:34 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12278
-
crell uploaded patch set 4 06/10/21, 22:38
-
core-ci voted on patch set 4 V -1 06/10/21, 22:40 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12288
-
crell uploaded patch set 5 06/11/21, 14:15
-
core-ci voted on patch set 5 V -1 06/11/21, 14:18 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12305
-
crell uploaded patch set 6 06/11/21, 15:02
-
core-ci voted on patch set 6 V -1 06/11/21, 15:19 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12308
-
crell uploaded patch set 7 06/11/21, 15:43
-
core-ci voted on patch set 7 V -1 06/11/21, 15:55 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12311
-
crell uploaded patch set 8 06/11/21, 16:17
-
core-ci voted on patch set 8 V -1 06/11/21, 16:29 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12312
-
crell uploaded patch set 9 06/11/21, 16:52
-
core-ci voted on patch set 9 V -1 06/11/21, 17:00 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12313
-
crell uploaded patch set 10 06/11/21, 21:05
-
core-ci voted on patch set 10 V +1 06/11/21, 21:14 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12323
-
crell marked it ready for review 06/11/21, 21:16
-
Oli Bartsch commented on patch set 10 06/11/21, 22:09
Hi Larry, I had a short read through the patch, but will dig deeper into it on the weekend. I already added some comments, mostly regarding changes which seem to be unrelated to the patch. Please always try to avoid such unrelated changes, especially in large patches like this. It makes reviewing much harder.EmailLoginNotification.php:106This seems to be unrelated. Also usages of this method do not reveal that this should be nullable. What makes you think that this should be nullable?Connection.php:107Seems to be unrelated.PageRepository.php:1011Seems to be unrelated.DatabaseWriter.php:33Seems to be unrelated.FileWriter.php:99If already changing this methods' signature, should we also add the return type?GeneralUtility.php:3543What's the reason for this change?ProductionExceptionHandler.php:33This seems to be unrelated.ValidatorTask.php:562Any specific reason for adding this inline annotation? -
crell commented on patch set 10 06/14/21, 12:14
I'm generally following campground-rules: Leave it cleaner than you found it. So if there's trivial fixes in close proximity to where I'm already making a change, I'll fix it along the way. As long as it doesn't break anything I think that's reasonable. (Though one of these did break something for a bit, but it's already fixed now.)EmailLoginNotification.php:106ReplyThe docblock says it accepts null, and it has a default value of null. Technically a default value of null without being nullable is soft-deprecated; there's been talk of making it an error but I don't think that's happened yet. So either it should be typed nullable or the docblock de-nulled and the default set to something not-null.DatabaseWriter.php:33ReplyMm, left over from when I was still trying to change the table name, but I punted that to a future issue. I'll be doing it then anyway so I don't see a reason not to include it here. It's effectively a constant.FileWriter.php:99Reply UnresolvedProbably, although I've been a bit more gunshy about return values. I'm all for typing everything we possibly can so if it's safe to do, let's do. (Arguably that's backwards given the variance rules in PHP 7.4+.)GeneralUtility.php:3543ReplyAnything with an @ is a potential for issues, especially as it covers less in PHP *. Also, method_exists() is the more-precise and thus IMO more-correct API call to use here; what it's trying to do is verify that the method is there to be called, and give an error if the method doesn't exist. So check method_exists specifically.ValidatorTask.php:562ReplyIntelliJ/PHPStorm can't detect the type returned from makeInstance(), so it doesn't know that $fluidEmail has a setTemplate() method and complains about the next line. adding a type annotation here tells static analyzers "trust me, this is a FluidEmail, assume I'm right." (Avoiding makeInstance() would be even better, but that's a longer-term thing.) -
Markus Klein commented on patch set 10 06/14/21, 12:33
ValidatorTask.php:562ReplyWe use a PHPStorm Plugin for this: TYPO3 CMS ;-) -
crell commented on patch set 10 06/14/21, 12:40
ValidatorTask.php:562ReplyPorque no los dos, as the kids say... -
Oli Bartsch commented on patch set 10 06/14/21, 13:35
Reply
In small patches, this surely will be ok. But as this patch proved, making unrelated changes can easily break something which is then really hard to debug. Luckily the testing framework found this before the patch got merged. Otherwise this had introduced a regression which would certainly have been difficult to find. Besides possible bugs, reviewing of such large patches already takes a lot of time. If one then also has to distinguish whether a change is relevant for the patch or not, it only makes the whole thing even more time-consuming. For sure, this is always a case-by-case thing (e.g. changing to type properties should be easy to detect). Just wanted to create awareness for it in general. :)EmailLoginNotification.php:106Reply> Technically a default value of null without being nullable is soft-deprecated; > there's been talk of making it an error but I don't think that's happened yet. Do you have some reference for this? This sounds interesting, as for me those two are different things. TYPO3 often uses NULL as default value for the use of guard clauses, while not allowing NULL to be passed.GeneralUtility.php:3543ReplyRegarding the @ I'm fully with you. However, method_exists just checks for existence. In L:3549 this method is then called which triggers a fatal in case the method is not callable (e.g. not public).ValidatorTask.php:562ReplyTherefore, TYPO3 features the https://github.com/TYPO3/TYPO3.CMS/blob/master/dynamicReturnTypeMeta.json file. Together with the mentioned plugin, PHPStrom understands those calls, making the inline annotations superfluous. -
crell commented on patch set 10 06/14/21, 16:19
EmailLoginNotification.php:106ReplyI checked and while it's been talked about, nothing has been implemented for it, it looks like. However, it is a mismatch for a type to specify that it requires a string, but could still sneak in a null. (That's why there's been talk of deprecating that, but it apparently hasn't happened yet.) Either way, the docblock currently says it's nullable, so either the type def or the docblock should be updated.GeneralUtility.php:3543Reply(For posterity, we discussed elsewhere and I'm switching it back to is_callable() but without the @, as the latter is unnecessary.)ValidatorTask.php:562ReplyThat helps PHPStorm, but not necessarily casual readers, or users of other IDEs. I can remove it if that's policy, but I think in these cases it's better to include explicit definitions in the source rather than relying on specific tooling. -
crell uploaded patch set 11 06/14/21, 16:19
-
core-ci voted on patch set 11 V -1 06/14/21, 16:28 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12427
-
crell uploaded patch set 12 06/14/21, 17:30
-
core-ci voted on patch set 12 V +1 06/14/21, 17:41 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12431
-
Anja Leichsenring commented on patch set 12 06/15/21, 17:39
LanguagePackService.php:279a placeholder is missing here, is suspect it should be {request}? -
crell commented on patch set 12 06/15/21, 18:02
LanguagePackService.php:279ReplyYep, I forgot to convert the first %s. Will fix. -
crell uploaded patch set 13 06/15/21, 18:02
-
core-ci voted on patch set 13 V +1 06/15/21, 18:13 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12463
-
Anja Leichsenring voted on patch set 13 V +1 CR +1 06/15/21, 18:28
-
Markus Klein commented on patch set 13 06/16/21, 07:43
AbstractWriter.php:118I'm not sure about this. We do have some class names within the Core that exist multiple times. The full namespace is helpful then. Also the stacktrace is vital. I need it regularly to inspect problems. Maybe the writers should have an option, where I can selectively enable the stacktrace? -
Christian Kuhn commented on patch set 13 CR -1 06/16/21, 08:57
on it. -
Christian Kuhn commented on patch set 13 06/16/21, 11:11
will push an update soon.EmailLoginNotification.php:106Replyfine with me.PasswordResetTest.php:34clever. we're not doing that often enough.Connection.php:107Replyyes. but good catch. and probably no v10 backport, so ... keep it ...PageRepository.php:1011Replyok to do as drive-by. we fixed an issue here in a previous patch-set.PageRepository.php:1019uids instead of uuids, let's not use wording uuid when they aren't. and: no implode here? array of arrays is properly handled?DatabaseWriter.php:33ReplyAckProductionExceptionHandler.php:33Replybut ok here.TypoScriptFrontendController.php:1171good!ValidatorTask.php:562ReplyIn general, we rather remove those hints for makeInstance() calls when an instance of `Whatever::class` is retrieved and add it for things like makeInstance($myClassName) to make phpstan and friends happy. Note you don't need the big typo3 cms plugin (I don't use it), the 'dynamic return type plugin' is enough for phpstorm to understand makeInstance().
-
Christian Kuhn commented on patch set 13 06/16/21, 11:11
PageRepository.php:1019ReplyDone -
Christian Kuhn commented on patch set 13 06/16/21, 11:32
AbstractExceptionHandler.php:88sidenote: this getIndpEnv() call (and the one below) could be dropped by accessing $globals['typo3_request']->getAttribute('normalizedParams') here -> single patch, please. -
Christian Kuhn commented on patch set 13 06/16/21, 12:15
AbstractExceptionHandler.php:88ReplyAckAbstractWriter.php:56AbstractWriter.php:79sidenote: there's ArrayUtility::renumberKeysToAvoidLeapsIfKeysAreAllNumeric() as a similar helper that removes 'holes' in numeric keys ... *maybe* we could later move this method over there in case it gets additional usages. -
Markus Klein commented on patch set 13 CR -1 06/16/21, 12:49
see my comment on stack traces -
Christian Kuhn commented on patch set 13 06/16/21, 12:53
Reply Unresolved
working on this currently. -
Christian Kuhn commented on patch set 13 06/16/21, 12:55
AbstractExceptionHandler.php:96misses 'message' key. -
Christian Kuhn commented on patch set 13 06/16/21, 13:14
AbstractExceptionHandler.php:91and we should add exception_code again, it's useful.AbstractExceptionHandler.php:96ReplyDoneAbstractWriter.php:118ReplyNo behaviour change. the message did not include full backtrace before, either, but data/context does. Example before patch from FileWriter: Wed, 16 Jun 2021 14:57:09 +0200 [CRITICAL] request="375fb151efa63" component="TYPO3.CMS.Core.Error.DebugExceptionHandler": Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Undefined array key "sub" in /var/www/local/coremaster/public/typo3/sysext/backend/Classes/Controller/AboutController.php line 121 | TYPO3\CMS\Core\Error\Exception thrown in file /var/www/local/coremaster/public/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 150. Requested URL: http://coremaster8.local.schwarzbu.ch/typo3/module/help/AboutAbout?token=--AnonymizedToken-- - {"TYPO3_MODE":"BE","exception":"TYPO3\\CMS\\Core\\Error\\Exception: PHP Warning:... FULL backtrace ... Example with patch: Wed, 16 Jun 2021 15:12:08 +0200 [CRITICAL] request="2861febd3e55d" component="TYPO3.CMS.Core.Error.DebugExceptionHandler": Core: Exception handler (WEB: BE): TYPO3\CMS\Core\Error\Exception, code #1476107295, file /var/www/local/coremaster/public/typo3/sysext/core/Classes/Error/ErrorHandler.php, line 150: PHP Warning: Undefined array key "sub" in /var/www/local/coremaster/public/typo3/sysext/backend/Classes/Controller/AboutController.php line 121 - {"mode":"WEB","application_mode":"BE","exception_class":"TYPO3\\CMS\\Core\\Error\\Exception","exception_code":1476107295,"file":"/var/www/local/coremaster/public/typo3/sysext/core/Classes/Error/ErrorHandler.php","line":150,"message":"PHP Warning: Undefined array key \"sub\" in /var/www/local/coremaster/public/typo3/sysext/backend/Classes/Controller/AboutController.p ... FULL backtrace ... So the only change is that a slight reformatting of the message, and full backtrace is still in data/context. -
Christian Kuhn uploaded patch set 14 06/16/21, 13:14
-
Christian Kuhn commented on patch set 14 CR -1 06/16/21, 13:15
fine with me codewise. will add an important.rst to point out the placeholder stuff. -
core-ci voted on patch set 14 V +1 06/16/21, 13:30 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12495
-
Christian Kuhn uploaded patch set 15 06/16/21, 13:42
-
crell voted on patch set 15 CR +1 06/16/21, 13:48
-
core-ci voted on patch set 15 V +1 06/16/21, 13:53 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12496
-
Christian Kuhn commented on patch set 15 CR -1 06/16/21, 14:12
we'll push a version without the context sub-array stuff again, this may give headaches with monolog later, so we omit this detail. -
crell uploaded patch set 16 06/16/21, 14:27
-
core-ci voted on patch set 16 V +1 06/16/21, 14:37 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12498
-
Markus Klein commented on patch set 16 CR -1 06/16/21, 14:40
DatabaseWriter.php:71where is $message used? -
crell commented on patch set 16 06/16/21, 14:44
DatabaseWriter.php:71ReplyIt's not. Leftover from previous drafts. Will remove. -
crell uploaded patch set 17 06/16/21, 14:44
-
Christian Kuhn commented on patch set 17 06/16/21, 14:45
DatabaseWriter.php:71Replynote: this writer will see a bigger rewrite soon, anyways. -
Christian Kuhn voted on patch set 17 V +1 CR +1 06/16/21, 14:50
-
core-ci voted on patch set 17 V +1 06/16/21, 14:55 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12499
-
Anja Leichsenring voted on patch set 17 V +1 CR +1 06/16/21, 15:17
-
Christian Kuhn voted on patch set 17 V +2 CR +2 06/16/21, 15:20
-
Christian Kuhn merged patch set 18 06/16/21, 15:21