The fix to fix all fixes! That weren’t very fixed. Before this fix! That fixes them.
A small percentage of the Zombie Apocalypse Theme for WordPress users were reporting a very strange phenomenon that made our theme look plagued with bugs. Everything was working but the pages were filled with errors and warnings similar to this:
Warning: Cannot modify header information - headers already sent by (output started at something/wp-content/themes/zombie-apocalypse/functions.php:256) in something/wp-login.php on line 349
or this
Warning: Cannot modify header information - headers already sent by (output started at something_else/wp-content/themes/zombie-apocalypse/functions.php:256) in something_else/wp-includes/pluggable.php on line 699
or even this
Warning: Cannot modify header information - headers already sent by (output started at something_elseR/wp-content/themes/zombie-apocalypse/functions.php:263) in something_elseR/wp-includes/functions.php on line 831
We were clueless at first about the cause of this bug since the theme passed all our tests and all the reviewers’ tests without any problems.
After a couple of hours of intense investigation we realized that the problem was caused by whitespaces. Yeah, can you believe that? Whitespaces.
Basically we had to remove all spaces between the php ending tag and the starting tag so they would look something like this in the actual code:
.... ?><?php ....
If there’s something else between these tags like HTML code, text or anything else then there’s no problem. So something like this is good:
?> <div>....</div> <?php
This is also good:
?> <h1> <?php
But this is bad, very very bad… this has been causing all the problems :
?> <?php
We had to turn that into this :
?><?php
This white spaces problem only occurred on IIS servers that ran php scripts as cgi/fcgi. But that’s fixed now so I’ll see you back here for 1.08 …