The problem was the line of code I posted used some quotes. WordPress tried to be helpful and converted them to smart quotes, which broke the code.
There are two solutions for this. I could have anticipated this problem and enclosed the line in a <code> tag. But I didn’t notice the problem until it was too late.
The other solution is to turn off the wptexturize filter that WordPress is running all text through. This not only prevents changing quotes, but also some other character conversions that will break code. You can put this in your theme’s function.php file or you own custom plugin.
You can check out the details of what wptexturize does at the official Codex page. It would be great to just disable a few of these. I suppose if you really wanted to you could disable wptexturize and enable a function of your own making that changes what you want.