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
Bug: Custom 404 error handler. Response caching. #5697
Comments
The current
It seems no problem. |
I don't think this is the correct approach. Although I may be wrong. CodeIgniter4/system/CodeIgniter.php Lines 926 to 928 in 93b8bca
|
It may not be correct, but what's wrong? |
I mean the concatenation of the data from the buffer and the returned string. |
Do you think the following is better?
I don't understand why it is "protection against the fool". |
For the same reason why you write a return type. |
I think it's dangerous to change that. I don't recall the reasoning it was there exactly but if it would be changed it would need a good chunk of additional tests to ensure all of the varieties of responses are covered, no matter how crazy they might be, so we don't break a less experienced coder's mess. |
PHP Version
7.3
CodeIgniter4 Version
4.1.8
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
If the custom 404 error handler does not output data to the buffer, then an empty body is returned.
Steps to Reproduce
Expected Output
Anything else?
In the
CodeIgniter::display404errors()
handler, the result of theCodeIgniter::runController()
method is not passed to theCodeIgniter::gatherOutput()
method.CodeIgniter4/system/CodeIgniter.php
Lines 859 to 867 in 827c360
CodeIgniter::gatherOutput()
If the data is not passed and there was no output to the buffer, then the response body is reset to an empty string.I think that we need to consider not only what the
CodeIgniter::runController()
method returns, but also what is contained in the response body.That is, it is necessary to define a priority between
echo
,return
andResponse::setBody()
.The text was updated successfully, but these errors were encountered: