PHP adding phantom output lines
| From: | Matthew Hagerty | Date: | Fri, 08 Sep 2000 20:46:35 +0000 |
| Subject: | PHP adding phantom output lines | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-32721@lists.php.net to get a copy of this message | ||
Greetings,
I posted this to a bug report quite some time ago, but it was *dismissed* as unable to reproduce. The problem happened with the switch to 4.x and I have been waiting to see if it was ever going to get fixed. It hasn't, so I thought I would try again to get the problem resolved.
Copy this to a .php file and run it. View the source. Looks fine. Then comment out the: $oHTML->do_html(); line and uncomment the same function call below, but leave the call broken across two lines, just after the arrow operator. Run it and view the source, there will be a blank line *before* the <HTML> tag.
I found this because it was creating output before I wanted output and my header() functions were failing. Again, this happened when moving from 3.x to 4.x.
Thanks,
Matthew
<?php
class htmlout
{
function do_html()
{
print "<HTML>\n<HEAD>\n</HEAD>\n";
print "<BODY>\nTest\n</BODY>\n</HTML>\n";
}
}
$oHTML = new htmlout;
$oHTML->do_html();
/* By placing the function on a separate line, php
generates a line of output. Comment out the
above line and uncomment the following 2. Then
view the HTML generated. Notice the blank
line above the <HTML> tag. */
//$oHTML->
// do_html();
?>