andig / videodb

The videoDB media collection software
65 stars 42 forks source link

Warning: Cannot modify header information - headers already sent by #181

Open copperhead57 opened 1 year ago

copperhead57 commented 1 year ago

@johanneskonst - Looking at cleaning up php messages. With config-debug turned on the following warning message is issued 'Warning: Cannot modify header information - headers already sent by...' This is caused by the following code in ...\core\httpclient.php lines 168, 169. if ($config['debug']) echoHeaders($response['header'])."<p>"; if ($config['debug']) echo "data:<br>".htmlspecialchars($response['data'])."<p>";

This occurs when a movie is displayed and videodb is querying imdb for the actors images via img,php.

Another consequence of the code is that when imdb online is selected it dumps the header and page data as source into the browser, but the imdb page is not rendered as JavaScript fails.

Questions 1 - is this code needed. 2 - could it be moved into 'httpclientlog' at line 172. (header is already being done here. ). would suggest tags added to file to find the start and end of each response. Suggested code if ($config['httpclientlog']) { $log = fopen('httpClient.log', 'a'); fwrite($log,"\n+++ Start header\n"); fwrite($log, headers_to_string($response['header'])); fwrite($log,"\n+++ End header"); fwrite($log,"\n+++ Start Data\n"); fwrite($log, htmlspecialchars($response['data'])."\n"); fwrite($log,"\n+++ End data"); fclose($log); } 3 - comment out for now and re-look at when issue 177 is done 4 - any other suggestions

johanneskonst commented 1 year ago

Yes, i've already started working on moving those bits to logfiles instead of outputting it direct to browser. Also adding debug=0|1|2 setting (off, on, verbose) and removing the httpclientlog one. Having a little free time right now, will pick this up probably somewhere next week... Thanks @copperhead57 !

/edit: oh, and happy new year! ;-)