Closed rochefort closed 9 years ago
You are great! I should have use ob_get_level
like this.
Thank you for your commit.
Output buffering of PHP is stackable.
Thank you for your report!
@kenjis I am having a same problem here, but my code is not simple as show_404
but really complicated. Do you have any advice on how to trace down the output buffering issue?
My test target method is using form_validation
, ReCaptcha
(third-party library) and bunch of models.
The reason PHPUnit reports risky is you have output buffer which is not cleared.
$this->request()
calls ob_start()
.
You have to search ob_start()
and make sure all of them are cleared and buffering is turned off.
@kenjis thank you, I found the reason.
There are severals call to ob_start()
in core/Exceptions.php
. When there is PHP Error in the application, CI render the error template and somehow mess around with the output buffering. I fixed that by fixing the error in my application code, not sure if this is a CodeIgniter's issue or should we fix it in ci-phpunit-test.
Anyway, the risky test helped me to know if there is unexpected PHP Errors in the output, so I find it helpful in an unexpected way.
I called
show_404
in a controller, but risky was occurred. I should close object inshow_404
. Any good ideas?message:
application code:
testing code: