php_john — 2012-11-08T17:55:15-05:00 — #1
I've stepped into this project, and I've been asked to solve a sticky issue, and I feel like I'm chasing a ghost. Hopefully some of you will have seen this before and can give me some direction.
When looking at the source, I see the following:
<font color='gray'><font face='Consolas'>
</font></font><!-- --><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
In the code that generates the page, the original programmer is using this:
ob_start(); // Start the Output buffer
include $DIR['templates'].'/'.$template; // include and process the file
$html = ob_get_clean(); // get the contents of the output buffer
The template being used has no white space above the DOCTYPE tag.
When $html is printed/echoed the code is simply,
but, that didn't strip those top lines.
The reason I'm focused on those lines is because it appears that it's messing with the headers and IE9 is freaking out.
I'm really at a loss and could use some help.
wonshikee — 2012-11-08T18:07:39-05:00 — #2
One quick test you should do:
See if the white spaces appear before or after test.
php_john — 2012-11-08T18:32:21-05:00 — #3
Thanks. Did that. The "<!-- -->" was the test text, and it came in below the blank lines.
There may be another reason that this is not working, and it may have nothing to do with the code.
I have been testing this in IE9 on a Windows 7 HOME edition, and it worked.
When tested in IE9 on a Windows 7 PROFESSIONAL edition, it did not.
Same versions of IE9 down to the last digit.
What in the world would be the cause of the problem on the Professional version as opposed to the Home version? (right now there are more indicators that this is the issue instead of the coding...)
serverstorm — 2012-11-09T10:31:57-05:00 — #4
Could it be the defaul CSS style sheet that has a large amount of padding/margins assigned by default?
Is it possible that you can gain access to another IE9 on a Windows 7 Pro to see if this is consistent there?
It would really stink, investing a lot of time or changing things when as you alluded to, you are not even sure the code is the problem.
php_john — 2012-11-09T12:23:43-05:00 — #5
We found one computer with Windows 7 Pro installed that would run the site as expected in ie9. All others would not (they also have Win 7 Pro and ie9).
And we're pulling out our hair trying to figure out what is different on that one stupid box that would allow it to work when all others do not. (can you tell I'm frustrated? )
I am hoping that someone else has encountered this and found a solution... but so far, it's not looking very hopeful.
wonshikee — 2012-11-09T12:29:29-05:00 — #6
Well, assuming you did exactly as I suggest (except with HTML comment vs "test"), then conclusion would be that the white space is BEFORE the template layer. So your search should be all PHP files loaded before hand, which have white spaces outside of PHP tags.
php_john — 2012-11-09T12:42:30-05:00 — #7
I agree, and I'm currently going through all the code trimming spaces and such.
If found, I sincerely hope that it clears this up, but it does not explain the inconsitancy between different computers running the same IE 9.
wonshikee — 2012-11-09T13:16:21-05:00 — #8
I would assume you have 3 files which probably end liek this:
causing the 3 blank lines.
php_john — 2012-11-12T12:10:44-05:00 — #9
Well... I went through ALL of the .php scripts and found several included files that did NOT have a closing tag (?>) for the script. I also found several scripts with trailing lines after the closing tag.
Cleaning this up, cleaned up the blank lines, and the IE 9 issue.
Thanks guys, for the feedback.
wonshikee — 2012-11-12T13:06:17-05:00 — #10
Just to let you know, not closing the PHP tag is actually a better way as it prevents these blank space issues. I always close it though because I'm OCD like that and it just looks unbalanced.
php_john — 2012-11-12T14:10:20-05:00 — #11
Hmmm.... This is so odd.
These changes worked on my boss's installation of IE 9, but not on others.
Then, someone said, "Hey! It's not working on mine!" She had IE8.
There was no error notification on IE9, but there was on IE8. "console.log" was not recognized.