Closed geggleto closed 7 years ago
This is due to BC, where we allow you to echo
instead of return ResponseInterface
.
I thought we had stopped that?
I don't remember it being removed. Maybe add to the 4.0 Roadmap.
I would then propose a different Strategy for capturing the buffer output from the callable and pass it down the chain.
ob_start();
$callable($req, $res);
$response->write(ob_get_clean());
Or we can possibly modify the current one to include a ob_* capture if the callable doesn't respond with a response interface?
I suppose we could make this a 4.0 thing
I would then propose a different Strategy for capturing the buffer output from the callable and pass it down the chain.
ob_start(); $callable($req, $res); $response->write(ob_get_clean());
https://github.com/slimphp/Slim/blob/3.x/Slim/Route.php#L324-L326
This would have to be a 4.0 thing anyway.
Currently, Slim does not enforce developers to return a ResponseInterface from a route callable.
Example:
Proper:
What should happen
An exception should be raised. \Exception("Response Interface should be returned from a Route Callable");