Repository navigation
Conversation
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Mario Alfonso Pym Mejía <pymm@hitss.com>
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
printErrorPage()andprintExceptionErrorPage()always callhttp_response_code(). When they are reached after output has already been sent (for example an error in the middle of a download, or an uncaught exception handled by the global exception handler), PHP logs "http_response_code(): Cannot set response code - headers already sent", which hides the real error in the log.The status code cannot be changed at that point anyway, so this only sets it while headers can still be sent. The check lives in a small private helper used by both methods.
This is the same warning as #45835. #47971 fixed it for one caller in
OC_Files; this guards the error page itself so it covers every path.The test runs the code in a separate PHP process, because PHPUnit buffers the test output and headers are never sent inside the test itself.
How to test
e.g.
ocs-provider/demo.php:curl https://your-instance/ocs-provider/demo.php.printExceptionErrorPage(new \RuntimeException('Demo'), 500).Unit test:
tests/lib/Template/TemplateManagerTest.phpChecklist
3. to review, feature component)stable32)AI (if applicable)