seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.43k stars 229 forks source link

Cannot modify header information / early doctype #430

Closed worstje closed 5 years ago

worstje commented 5 years ago

I am not sure about older versions, but I just installed from the master branch and came across

Warning: Cannot modify header information - headers already sent by (output started at /volume1/calibre/cops/epubreader.php:1) in /volume1/calibre/cops/epubreader.php on line 14

while testing out the online epubreader functionality. It only shows up for a flash, but I assume that the lacking content-type header might cause problems when reading ebooks.

The cause is obvious and the fix does not seem too difficult, but I don't have the time nor know codebase well enough to go write patches and test them to the degree they should be. That said, I hate writing incomplete bug reports...

As such, because this warning was relatively well-hidden by all the other things that load, I have taken a quick peek at other PHP files to see if any of them write to the output before the initial includes are brought in (in the assumption those might try to write headers in particular configurations).

Of those, only checkconfig.php also writes a doctype right at the start. No biggie if that breaks due to its simplicity, but I'd personally still adjust it to make sure the initial includes can send headers without errors being thrown.

seblucas commented 5 years ago

Thanks for the report I'll fix that next week