I'm don't know why exactly you have to stop script execution here:
|
header('Content-Type: application/json'); |
But I assume there are technical reasons for it. I've encountered the same in the past and I've solved it by throwing a custom exception which you can then catch in the controller.
Not aborting the script execution has a few advantages:
- You don't miss setting the
Content-Length header like it is now ;-)
- You can continue the script execution flow which means events etc. can still be fired after that before e.g. the response is sent to the client
- Debugging scripts can continue to work
- etc.
Just as an idea ;-) Over at Contao we even built a ResponseException which takes a Symfony HttpFoundation Response as argument so you can send a proper response from within legacy code :-)
I'm don't know why exactly you have to stop script execution here:
Shel.Neos.Terminal/Classes/Command/FlushCacheCommand.php
Line 73 in bf3f1e7
But I assume there are technical reasons for it. I've encountered the same in the past and I've solved it by throwing a custom exception which you can then catch in the controller.
Not aborting the script execution has a few advantages:
Content-Lengthheader like it is now ;-)Just as an idea ;-) Over at Contao we even built a
ResponseExceptionwhich takes a Symfony HttpFoundationResponseas argument so you can send a proper response from within legacy code :-)