You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a correct response, and in case of a 404 error, if a custom handler is defined, the CodeIgniter::gatherOutput() method is called. In which we are trying to complete the monitoring of the buffer.
// Clean (erase) the output buffer and turn off output buffering
if (ob_get_length()) {
ob_end_clean();
}
But this code only works if something was passed to the buffer, such as using echo.
If nothing has been written to the buffer, then buffer monitoring is not disabled.
Also, if the ob_start() function has been called multiple times while the application is running, then ob_end_clean() will only terminate the last one.
This is an example of code that, in my opinion, will solve the buffer monitoring problem if you replace the ob_ function calls in the CodeIgniter::tryToRouteIt() and CodeIgniter::gatherOutput() methods with the appropriate methods class.
It will also remove redundant code.
PHP Version
7.4
CodeIgniter4 Version
all
CodeIgniter4 Installation Method
Git
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
The application starts monitoring the buffer in the
CodeIgniter::tryToRouteIt()
method.CodeIgniter4/system/CodeIgniter.php
Line 813 in 42b174f
For a correct response, and in case of a 404 error, if a custom handler is defined, the
CodeIgniter::gatherOutput()
method is called. In which we are trying to complete the monitoring of the buffer.CodeIgniter4/system/CodeIgniter.php
Lines 1009 to 1014 in 42b174f
But this code only works if something was passed to the buffer, such as using
echo
.If nothing has been written to the buffer, then buffer monitoring is not disabled.
Also, if the
ob_start()
function has been called multiple times while the application is running, thenob_end_clean()
will only terminate the last one.Steps to Reproduce
Expected Output
Normalize work on the buffer.
Anything else?
In the \CodeIgniter\Debug\Exceptions class, buffer monitoring also ends incorrectly.
CodeIgniter4/system/Debug/Exceptions.php
Lines 273 to 275 in 42b174f
This is an example of code that, in my opinion, will solve the buffer monitoring problem if you replace the
ob_
function calls in theCodeIgniter::tryToRouteIt()
andCodeIgniter::gatherOutput()
methods with the appropriate methods class.It will also remove redundant code.
CodeIgniter4/system/CodeIgniter.php
Lines 1018 to 1022 in 42b174f
The text was updated successfully, but these errors were encountered: