File download and spurious CR
Posted: Sat Mar 05, 2005 7:33 am
It was a struggle to debug this, and all sorts of other things seemed more likely than the final explanation. Such is the way!
I support Remository, a file repository for the Mambo CMS. The download mechanism has been changed by me, and relies on sending headers followed by the file, simple transferred using readfile().
When the PHP routine just dropped off the end, this apparently resulted in IE and Firefox receiving files with a stray CR character on the end. Opera (my preferred browser) did not. The CR did no harm for most purposes, but upset PCLZIP, which is used for component installation in Mambo. There, the CR caused a fatal error (with unhelpful diagnostic).
The solution is to code an exit statement at the end of the PHP. That solves the problem, but I am left asking if anyone knows why it does?
I support Remository, a file repository for the Mambo CMS. The download mechanism has been changed by me, and relies on sending headers followed by the file, simple transferred using readfile().
When the PHP routine just dropped off the end, this apparently resulted in IE and Firefox receiving files with a stray CR character on the end. Opera (my preferred browser) did not. The CR did no harm for most purposes, but upset PCLZIP, which is used for component installation in Mambo. There, the CR caused a fatal error (with unhelpful diagnostic).
The solution is to code an exit statement at the end of the PHP. That solves the problem, but I am left asking if anyone knows why it does?