Debugging help - PHP include causes page refresh -
i'm having odd problem can't seem track down. regards debugging greatly appreciated!
let me describe using scenarios.
scenario 1 (incorrect)
- php calls out cas server (using
curl_exec
) , gets user info back - php checks database ensure user returned cas exists , fails (which correct, i'm testing non-existent user) , sets error message "user not found" (this correct error message)
- php includes
top.php
file - the page randomly refreshes or redirects , starts process over...this can't figure out.
- php calls out cas server (using
curl_exec
) , receives error since cas ticket has been used, setting new error message of "cas rejected credentials" (which not correct) - php includes
top.php
file , doesn't refresh/redirect second time - php prints out "cas rejected credentials" (which not correct)
scenario 2 (semi-correct)
- php calls out cas server (using
curl_exec
) , gets user info back - php checks database ensure user returned cas exists , fails (again, correct, i'm still testing non-existent user) , sets error message "user not found" (this correct error message)
- i skip
top.php
since commented out, , print out "user not found" (this correct error message)
debugging
so, have checked, double-checked , triple-checked top.php
doesn't use include
, require
, redirect
(a function wrote prints <meta>
redirect tag , calls exit;
), or other thing refreshes page.
in fact, i've put in die
statement prints out error message. on 1 line in top.php
, prints out correctly. when move statement down 1 line (below html </div>
tag), refreshes page , prints incorrect error message. there aren't php tags anywhere close.
as far can tell, means problem not in top.php
file, since printing out </div>
should never cause page refresh/redirect.
any ideas on how debug here enormously helpful. clearing caches/buffers? how better track php doing?
note: no php errors being output.
update: yay, found culprit! instead of calling include 'top.php';
copied/pasted code inside login.php
, presented same problem. began deleting lines until found 1 causing problem:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
so, switching question entirely since didn't have of question in first place: can explain why causes page refresh, , why (i.e. doesn't continually refresh page)?
if have firefox grab copy of livehttpheaders. turn on , go through scenario 1. trace through http request , response headers see happening there. should provide more information on happening between browser , server.
Comments
Post a Comment