Why does REST Response not end the execution?
Question
In FuelPHP when using Controller_REST I can't use \Response as REST controller has its own Response functions using $this->response...
But when I execute this function and pass a body and a response code.
$this->response(array("Missing Parameter"), 400);
Like so, this doesn't actually end the execution and the function calling it carries on. If I use
exit;
The Response is broken. Does anyone know why this happens or is it a bug?
Solution
Try using return;
instead of exit;
. Usually you do not want to stop everything but just the execution if your business logic.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow