I use header Location across my site and there was no problem. I then added a language (French) and had to save my files in Unicode UTF 8 including BOM elements…
Now my header location doesn’t work anymore…the weird part being that there is no error message displayed…
So I updated my function to display a self made error message…see below
function redirect_to( $location = 'index.php'){
// code reached, error_reporting test
#flush();
if (headers_sent()) {
echo 'Debug: would send location header ', $location, $unsetVariableTriggeringWarning;
die('cannot send location header (anymore)');
}
else {
header('Location: '.$_SESSION['base_url'].$location);
die();
}
}
And I do get the error message now:
Debug: would send location header access.php?redirecto=accountcannot send location header (anymore)
But nothing has been printed out yet, no HTML, no PHP, no nothing. So my best guess was when I converted to Unicode utf8, there must of been something that happened. So I switched back, but still, the error persists…
Any help, much appreciated.
The PHP engine does not consume the BOM that would be before the
<?phpin the script, so it will be sent out as usual. Remove the BOM.