Open shadowhand opened 9 years ago
:+1:
:+1:
This won't work.
Any time the headers have already been sent, this will produce another error, creating an endless loop.
@brandonsavage that can be changed. The formatted response can be generated before printing any output or sending headers.
Suppose somebody is writing an application, and in their template, halfway through rendering the page, they reference a variable that is not in scope. They trigger a notice. Under this scheme we'll attempt to send headers back when headers have already been sent. That simply won't end well.
@brandonsavage that could happen but I think it is fairly uncommon practice to not have output buffering in place.
Formatters should also do something like this:
So that when the formatted output is returned, the appropriate type can be set: