Hey, remember how anyone who talks about coding style is all like “use more whitespace. Whitespace makes code more readable,” right? (hint: the answer is “yes.” If you answered anything else, you’re doing it wrong, and you should use more whitespace. Whitespace makes code more readable.)
Well, PHP has this great (read: terrible) idea in which you’re really just writing XML, and the actual code is kinda embedded within it. This means that if you add whitespace in the wrong places, it gets included in the final page shown to users. Usually this is not a problem, because in HTML extraneous whitespace gets ignored. However, if you’re writing true (non-HTML) XML (like, you’re generating an RSS feed or something), apparently the very first line of the file needs to start with
<?xml ...?>, or else it doesn’t parse correctly.
WordPress has a file called
functions.php, where you put miscellaneous utility functions. I had added a function to it that would append a ‘→’ to all cuts on my blog, I had responsibly surrounded it with documentation explaining what it does and how it interacts with the rest of the system, and I separated it from the previous function with a blank line so they wouldn’t run together and look like a single giant function. What I failed to realize was that
functions.php is used in the stuff that generates RSS feeds, which means that suddenly the RSS feed had a blank line before the
<?xml?> tag, which meant it failed to parse correctly, and broke. That’s right—I broke my website by adding documentation. This is fixed now, but it’s the dumbest problem I’ve seen in a while. If you ever design a programming language or markup language (or, heck, anything that gets parsed), please, please, for the love of Zeus allow blank lines to be added in arbitrary places without affecting the functionality.