[thelist] PHP Header oddness
Phil Turmel
philip at turmel.org
Fri Oct 7 10:52:15 CDT 2005
Steve Lewis wrote:
[snip]
> I suppose I wasn't too clear about this detail, but I have a workaround.
> The workaround looks like adding the following function to the library:
>
> function forward_to($url)
> {
> header("Location: ".$url);
> }
>
> and changing the if/else to
[/snip]
This workaround is hiding the real problem... If you look at the error
you were getting, it's not from parsing, but from execution. PHP
doesn't care how many times you call the header() function, but it does
care if headers have been "finalized" by some non-header output going to
the browser.
The line numbers in the error message clearly show the problem was
caused by the line BEFORE the "if (retval)" statement (unless the sample
code was not a direct cut & paste).
Your workaround likely deleted the whitespace or other content that was
being output. Might even have been non-printing characters outside of a
<?php ?> block. Or if it was a function call, the function output
something. Whatever was output should have been visible in "view
source" for the problem page.
HTH
Phil
More information about the thelist
mailing list