Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
copperhead57 opened this issue Jan 2, 2023 · 1 comment
Open
Assignees
Labels
feedback-wanted Looking for feedback on the issue at hand. Opinions please, constructive ones preferred.
Milestone

Comments

@copperhead57
Copy link
Collaborator

@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

@copperhead57 copperhead57 added the feedback-wanted Looking for feedback on the issue at hand. Opinions please, constructive ones preferred. label Jan 2, 2023
@johanneskonst
Copy link
Collaborator

johanneskonst commented Jan 2, 2023

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! ;-)

@johanneskonst johanneskonst added this to the 4.2 milestone Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback-wanted Looking for feedback on the issue at hand. Opinions please, constructive ones preferred.
Projects
None yet
Development

No branches or pull requests

2 participants