CollaboraOnline / richdocumentscode

Built-in CODE Server app
https://apps.nextcloud.com/apps/richdocumentscode
Apache License 2.0
121 stars 29 forks source link

http_response_code(): Cannot set response code - headers already sent #270

Closed modir closed 6 months ago

modir commented 6 months ago

I did now an update to the latest version of CollaboraOnline and now it is not possible anymore to open files. The log is filled with this warning:

PHP Warning: http_response_code(): Cannot set response code - headers already sent (output started at /srv/httpd/nextcloud/apps/richdocumentscode/proxy.php:285) in /srv/httpd/nextcloud/apps/richdocumentscode/proxy.php on line 292

It is very likely this is the problem.

modir commented 6 months ago

Wrong repo. Sorry my mistake

michnovka commented 2 months ago

Why was this closed? Where did you end up reporting @modir I see there was an issue https://github.com/nextcloud/richdocuments/issues/3699 but you were told to open it here. Now here it is closed. So where can I track this?

I have the same issue on my nextcloud

modir commented 2 months ago

@michnovka In the end a full reboot solved the problem. The software behind the proxy sent something in the newer version which the "old" proxy didn't like. So once I rebooted I had the new Collabora and the new proxy and the problem disappeared.

derRichter commented 1 month ago

here the same error. i wondered me to, what is the reason to close this bug without answer or fix?

get error: PHP Warning: http_response_code(): Cannot set response code - headers already sent (output started at /var/www/nextcloud/apps/richdocumentscode/proxy.php:289) in /var/www/nextcloud/apps/richdocumentscode/proxy.php on line 296

upgraed to Collabora Online - Built-in CODE Server Version 24.4.802, APACHE-lizensiert

full reboot the hole server

error and bug, still exist!

giox069 commented 3 weeks ago

Same problem here, and a full reboot of the server did not solved it. I deleted line 296 http_response_code(200); and now I can open .odt files again. The code seems to be incorrect, because there are some "print" just before http_response_code(200); Can anyone fix it ? Is my solution to delete that line right ?

edit: there is another couple of http_response_code() in the wrong place, after a "print", I think they should be moved before the "print". And both http_response_code(200) can be removed, since 200 it's the default.

edit2: I think you can reproduce the problem only enabling display_errors on php.ini (or php_admin_value). When display_errors is enabled, the error generated by http_response_code() after print is also sent to stdout, messing up the http response sent to the browser.