I am having the most annoying bug to squash. ANY ideas are greatly appreciated.
The situation:
I am using latest dev version of php with sablotron. All pages are produced in xml and converted with xsl sheets to html.
Anyway, when a session starts (ie. it's a users first visit to the site), I send the xml to sablotron, which returns the HTML code and I output it.
Problem:
The last tag minus the beginning "</" is placed at the top of the document.
Eg: What should be this:
"<yada></yada>"
Becomes this:
"HTML><yada></yada></"
Then if I reload, everything is fine. The HTML is just how I want it.
What I have noted is:
- I can easily reproduce this error on some pages, but not all
- the larger the XSL file, the more likely it seems that the bug occurs
- If I output ANY text with a normal "echo" before I output the generated HTML, the broken tag is STILL shown before anything else
- If the last tag is a beginning tag (eg "<YADA>"), it's still broken into "YADA>".
The solution I have used to far is to place a simple empty tag, "<>", at the end of the generated HTML. On first visit users will get a ">" at the beginning of the page, and on reload the last tag will just be empty and invisible. At least it's better than showing a big ugly "HTML>" as the first text.
As I said, any ideas are greatly appreciated.
Cheers,
Jens