Very sorry to have to do this. I have the following constants DEFINEd in 1 file (constants.php):
define('ROOTDIR', '/var/www/OrgName');
define('INCLUDESDIR', ROOTDIR.'/ssincludes');
define('CLASSESDIR', ROOTDIR.'/ssincludes/classes');
define('WEBSERVERIP', 'my.very.special.ip');
define('ROOTDIREXT', '/OrgName/html');
define('ROOTSITE', 'http://'.WEBSERVERIP.ROOTDIREXT);
then in a php file that simply verifies a user account doesn't already exist, and if not validates the incoming POST data and creates a new user MySQL record for a new user (whichever appropriate), I have this code (stripped non-relevant, I think):
require('../../ssincludes/constants.php');
require(INCLUDESDIR.'/utilities.php');
require_once(CLASSESDIR.'/clsScout.php');
require_once(CLASSESDIR.'/manager/ClassManager.php');
require_once(CLASSESDIR.'/manager/ClassCode.php');
//Then start - continue the session so PHP knows how to reconstruct the session object
session_start();
SessionCheck(); //A function in utilities.php that just refreshes some $_SESSION[] vars
//Handle the current state of the Authenticator flag
if(!isset($_SESSION['Authenticated'])) {
$_SESSION['Authenticated']=false;
} else {
if($_SESSION['Authenticated']==true) {
$_SESSION['Message'] = "You are already logged in and do not require a new account.";
header("Location: ".ROOTSITE."/index.php");
}
}
MakeUser();
header("Location: ".ROOTSITE."/index.php");
exit;
function MakeUser() {
//Does various things, I have verified no output
return;
}
The header statement is failing from the perspective of the Chrome browser. Inspecting the result from HTML side, I see this:
<html>
#shadow-root (open)
<shadow>
->head reveal
->body reveal
</shadow>
<style>
</style>
<head>
</head>
<body>
</body>
</html>
Searches for the text HTML HEAD BODY SHADOW (etc) in the php program file and in all of the included files yields no results. Clearly (to me anyway), something is injecting the output, maybe PHP via an error, but php.ini is set to display errors (dev site) and it certainly does so for other pages.
Has anybody seen this output? I guess I'm looking for abstract ideas, maybe even Chrome "assuming" something and it's not real output. The php in question is called via a direct (FORM method='PST' action='thispage.php') submission, so there is no JS lingering either.
Any help or ideas would be appreciated.
--UPDATE--
I never resolved this issue, fortunately for me the server blew up. I'm on a new server and re-launching the code on it. Same issue with new server but this time I was a bit more ready for it. Since this post is getting stale, I thought I would share, maybe somebody has a 'concept' I could pursue.
From a REQUIRE PHP class, browser wasn't getting anything back (except for 200), so I used tattle-tales in the class (class generates HEAD code and farms out some top of body code):
echo "Seem to not be having any problem here so far<br />";
$this->content = $this->MakeBigFatString();
echo "And we're back, wanna see?<br />";
var_dump($this->content);
return $this->content;
I get:
Seem to not be having any problem here so far
And we're back, wanna see?
string(960) " "
I think I'll be looking for "locale" mal-functions or the like.
-- SOLVED --
In a function in an included toolbox:
(string)$query = "SELECT ContactType FROM contacttype ORDER BY ContactType";
(object)$result = $db->query($query);
if(!$result || $db->errno || $result->num_rows==0) {
$content .= "</select>
";
unset($query);
echo "This line prints if below exit is used<br />";
//exit;
@$result->free();
//this line is never reached if @result->free() is allowed to execute
//no 200, no exceptions, no nothing, just blank stares
//PHP error displays, error logging, html errors -- all turned on
//just nothing
$db->close();
return $content;
}
Mildly disturbing.
The HTML you see is default in Chrome. But you say you get an error? What is the error message? And does it fail to redirect?
Another thing. Everytime you redirect with the header() function, you should ALWAYS use a die() or exit() afterwards. Or else you will just set the header but not redirect immediately.
And maybe you should rewrite this:
if(!isset($_SESSION['Authenticated'])) {
$_SESSION['Authenticated']=false;
} else {
if($_SESSION['Authenticated']==true) {
$_SESSION['Message'] = "You are already logged in and do not require a new account.";
header("Location: ".ROOTSITE."/index.php");
}
}
To:
if(isset($_SESSION['Authenticated']) && $_SESSION['Authenticated'] == true){
$_SESSION['Message'] = "You are already logged in and do not require a new account.";
header("Location: ".ROOTSITE."/index.php"); die();
}
Change this line
header("Location: ".ROOTSITE."/index.php");
To this
echo <script> window.location = "'.ROOTSITE.'/index.php"'.'</script>';