We just had a very nasty issue in a recent theme: some buyers complained about “Headers already sent” warning upon theme activation which caused massive boos like getting blank pages, being unable to login or create new pages and so on.
The issue was caused by a single extra (damn) newline char placed after a closing ”?>” in one of the theme classes file but the real question for us was “how the f**k this didn’t happen with any of the multiple wp installations running on different servers/platforms where we had tested theme ?”
So today, after a bit of research, we figure out that when php outbut_buffering option is enabled, you most likely never get a “Headers already sent” warning. We had it enabled in all our php installations like any other buyer not experiencing the issue.
Our friendly advice would be to turn that option off for your testing machine, i don’t know if theme/plugin installation is part of the review process but if it’s the case, reviewers should also disable output buffering.
Yep closing PHP tag is generally not used, especially on class files.
and php docs say its not required: http://docs.php.net/manual/en/language.basic-syntax.instruction-separation.php
always a touchy point with devs though
personally I tend to skip the end closing tag because of a bad hidden white space issue in a utf8 encoded file i had ages ago after transferring it via ftp.
Hm, I had that error, I repaired it but never knew the real source. Thanks for sharing.