84134[TASK] Allow runtime event listeners
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 1
Review log 1926
Show 1 earlier messages
-
Oliver Hader uploaded patch set 1 05/02/24, 21:00
-
core-ci voted on patch set 1 V -1 05/02/24, 21:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57119
-
Oliver Hader commented on patch set 1 05/02/24, 21:09
PolicyProvider.php:91move outside if block -
Oliver Hader wrote 06/27/24, 09:59
Topic set to csp -
Oliver Hader commented on patch set 1 06/27/24, 13:44
PolicyProvider.php:74ReplyDonePolicyProvider.php:91ReplyDone -
Oliver Hader uploaded patch set 2
V -106/27/24, 21:09 -
Oliver Hader uploaded patch set 3 06/27/24, 21:12
-
core-ci voted on patch set 2 V -1 06/27/24, 21:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60503
-
core-ci voted on patch set 3 V -1 06/27/24, 21:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60504
-
Oliver Hader uploaded patch set 4
V -106/28/24, 08:29 -
core-ci voted on patch set 4 V -1 06/28/24, 08:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60540
-
Oliver Hader uploaded patch set 5
V -106/28/24, 18:08 -
core-ci voted on patch set 5 V +1 06/28/24, 18:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60588
-
Oliver Hader uploaded patch set 6
V +107/01/24, 07:54 -
core-ci voted on patch set 6 V -1 07/01/24, 08:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60731
-
Oliver Hader uploaded patch set 7
V -107/01/24, 08:27 -
core-ci voted on patch set 7 V +1 07/01/24, 08:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60736
-
Oliver Hader commented on patch set 7 07/01/24, 08:54
This change is ready for review. -
Stefan Bürk commented on patch set 7 07/01/24, 09:31
I guess that this should work, but this needs to be tested with installed and activated adminpanel. -
Christian Kuhn commented on patch set 7 07/01/24, 11:13
why / what for? -
Christian Kuhn commented on patch set 7 CR -1 07/01/24, 11:21
ListenerProvider.php:72I'm rather reluctant on this approach - listeners should be a compile time / early bootstrap thing. I think this approach is really complex and gives me headaches when thinking about the implications. For instance: What happens with sub requests here? I'll add -1 to the approach for now, and would love to at least get some additional feedback from for instance Benjamin Franzke. -
Oliver Hader commented on patch set 7 07/01/24, 14:43
Reply Unresolved
Please have a look to the relation chain...ListenerProvider.php:72ReplyThanks for your feedback! > listeners should be a compile time / early bootstrap thing Can you please explain, why it should be like that? Is that something that is specified in PSR-14 for instance? > What happens with sub requests here? I don't really understand the question. Are you referring to sub requests in tests? As long as the DI container static is reset, there also will be a new instance of the `ListenerProvider`... -
Christian Kuhn commented on patch set 7 07/02/24, 01:58
ListenerProvider.php:72Reply> > listeners should be a compile time / early bootstrap thing > > Can you please explain, why it should be like that? Is that something that is specified in PSR-14 for instance? well, for instance, runtime listeners will never be shown in the 'event listener' list in BE. that's of course only a side-issue, but it validates my general concern. > > What happens with sub requests here? > > I don't really understand the question. Are you referring to sub requests in tests? > As long as the DI container static is reset, there also will be a new instance of the `ListenerProvider`... afaik, this is not the case. sub requests do not re-init container and reset to current after response retrieval: only partially in TF, and not at all within FE 404 sub request handling (page content error handler iirc). this area has never been taken care off properly (yet?), and there is also no api that takes care of framework state - TF does this with a hack, FE 404 handling ignores it completely, custom extensions probably don't even know there is an issue. -
Oliver Hader commented on patch set 7 07/02/24, 18:13
ListenerProvider.php:72Reply> > > listeners should be a compile time / early bootstrap thing > > > > Can you please explain, why it should be like that? Is that something that is specified in PSR-14 for instance? > > well, for instance, runtime listeners will never be shown in the 'event listener' list in BE. that's of course only a side-issue, but it validates my general concern. The consequence of that is, that event handler will always be triggered in any scope - since they are registered globally... > > > What happens with sub requests here? > > > > I don't really understand the question. Are you referring to sub requests in tests? > > As long as the DI container static is reset, there also will be a new instance of the `ListenerProvider`... > > afaik, this is not the case. sub requests do not re-init container and reset to current after response retrieval: only partially in TF, and not at all within FE 404 sub request handling (page content error handler iirc). this area has never been taken care off properly (yet?), and there is also no api that takes care of framework state - TF does this with a hack, FE 404 handling ignores it completely, custom extensions probably don't even know there is an issue. It seems that `$container = Bootstrap::init(ClassLoadingInformation::getClassLoader());` is called for TF frontend requests, which creates a new instance of the DI container. However, it this DI container is not swapped back in the TF after the sub request was finished. -
Oliver Hader abandoned the change 07/02/24, 18:14
I'm fine with dropping this for a static approach - but please let's avoid calling that clean architecture... it's not... -
Christian Kuhn commented on patch set 7 07/02/24, 18:29
ListenerProvider.php:72Reply Unresolved> > well, for instance, runtime listeners will never be shown in the 'event listener' list in BE. that's of course only a side-issue, but it validates my general concern. > > The consequence of that is, that event handler will always be triggered in any scope - since they are registered globally... yes. that's the drawback. i'm aware of that. BE will now instantiate RequestHandler to fire the event. I don't like it much, but it's not really bad since FE RequestHandler __construct() is DI only. I guess we may want to review these events, or refactor the CSP stuff a bit, or ... I don't know. > It seems that `$container = Bootstrap::init(ClassLoadingInformation::getClassLoader());` is called for TF frontend requests, which creates a new instance of the DI container. However, it this DI container is not swapped back in the TF after the sub request was finished. Yeah. Seen that. It *might* be obsolete, though. I think we need to re-review container state for sub requests anyway. This pairs with the GeneralUtility singleton state, I guess we should have a combined solution plus API for stuff like this. I'd try to raise awareness on this with Franzke when we find the time, and this may be an issue with 'composer based functional tests' as well.
PolicyProvider.php:74