-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
!!! TASK: Remove dispatched state from ActionRequest #3301
Conversation
57170ee
to
f5b137f
Compare
868c1ca
to
55dcf60
Compare
Neos.Flow/Classes/Mvc/Dispatcher.php
Outdated
if ($request->isMainRequest()) { | ||
return $response; | ||
} | ||
$request = $request->getParentRequest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed we concluded that this logic might be faulty and actually do harm without the isDispatched
in place.
background:
the dispatcher is either used for main request, in which case this logic is not needed,
or for subrequest like in a fusion plugin
scenario:
a subrequest, while being handled, throws a StopActionException
.
which is catched here. We check if its a main request and get the main request which is now to be handled in the loop, like a forward.
Thesis:
Now it will actually render the outer response inside the plugin
But previously because the main request was dispatched === true, it would not be handled.
So in theory this is dead code, and now must be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the thesis seems to be correct. Using throwStatus
in a plugin will result in the main request rendering being started again an again until the memory is exhausted.
Removing this code will actually make the tests dispatchIgnoresStopExceptionsForFirstLevelActionRequests
and dispatchCatchesStopExceptionOfActionRequestsAndRollsBackToTheParentRequest
fail, so i wanted to research about the original intentions.
It seems that with the introduction ff05084#diff-450585af3bb27be2be268192637242195c5d6308512fd53dac9fa248ff319686 of sub request, this logic was introduced. (perviously all first level StopActionException
where silently swallowed)
} catch (\F3\FLOW3\MVC\Exception\StopActionException $stopActionException) {
if ($request instanceof \F3\FLOW3\MVC\Web\SubRequest && $request->isDispatched()) {
throw $stopActionException;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i removed the
if (!$request->isMainRequest()) {
$request = $request->getParentRequest();
}
part in 0ed5f28 ;)
We further discussed that the One must use the |
080c854
to
f37ce2c
Compare
e1491b0
to
2414a7b
Compare
2414a7b
to
faef9bc
Compare
TLTR: Since the separation of http and cli requests the interface is completely unused. And strict types against its only implementation, the ActionRequest make it impossible to implement a custom request. -------- _Initially_ the interface was introduced with 2a26925 at beginning of time. At that time this was done probably to be able to type against the interface instead of the common `Request` class, that the Cli and Web Request both extended. With the removal of many methods in its interface 8c40ff2 and with the full separation of action and cli requests #1552 the interface became useless. The dispatcher and controller interface are both typed against the `ActionRequest` and so it's impossible to implement a custom request.
…patcher As discussed we concluded that this logic might be faulty and actually do harm without the `isDispatched` in place: Background: the dispatcher is either used for main request, in which case this logic is not needed, or for subrequest like in a fusion plugin Scenario: A subrequest, while being handled, throws a `StopActionException`. which is caught here. We check if it's a main request and get the main request which is now to be handled in the loop, like a forward. Thesis: Now it will actually render the outer response inside the plugin But previously because the main request was dispatched === true, it would not be handled. Example: Using `throwStatus` in a plugin will result in the main request rendering being started again and again until the memory is exhausted.
fe1e940
to
8c81fd0
Compare
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions