WordPress bug with post comment feeds

In the tradition of Apple Bug Friday (RSS), this post inaugurates WordPress Bug Friday. Actually, it’s just a coincidence that I fixed the bug on a Friday. Anyway, the bug is that the comments feeds for posts were returning HTTP code 304 (Not Modified) in Vienna, even though the posts had new comments that did appear in the main comments feed for the blog. Vienna, being a good net citizen, reads the Last-Modified date from a feed’s HTTP headers and sends the date back as If-Modified-Since in its request headers to the feed.

The cause of the bug in WordPress 2.0.4—as well as earlier versions of 2.0, I believe—appears to be that the comments feeds for posts were checking the last modified date for posts rather than the last modified date for comments, because unlike the main comments feed for the blog, http://lapcatsoftware.com/blog/comments/feed/, the comments feeds for posts, e.g., http://lapcatsoftware.com/blog/2006/10/09/stand-and-unfold-yourself/feed/, do not contain /comments/ in their URLs.

I discovered a ticket at the WordPress Trac discussing the bug, along with a patch. The patch was just two lines of code (or one, depending on how you count), so the change in the file /wp-includes/classes.php was easy to make, and it seems to be working fine now. Please let me know if you experience any problems.

While I’m on the subject of WordPress bugs, I’ll mention another one that has bit me a few times. If your post includes escaped HTML characters such as less-than and greater-than symbols, then when you edit your post again after saving or publishing, WordPress unescapes the characters in the editing view. Consequently, if you don’t re-escape those characters before saving or publishing, your post will be messed up. The technical term to describe this situation is lame. In some circles, they use sucky. My workaround is to compose a post entirely in a text editor such as Smultron and ensure that everything is perfect before I enter the post once and only once in WordPress.

Thus our first edition of WordPress Bug Friday comes to a close. I would be remiss, perhaps, if I did not also throw in an Apple bug. Since this post is lacking somewhat by my usual standards of (attempted) humor, I’ll mention an amusing and harmless little bug I came across. As a member of the Apple Developer Connection, I receive a monthly mailing containing a DVD with documentation and software updates. On the mailing label a few months ago, between my name and address, there was a line with the text NULL. Obviously the mailing label software was printing an additional field that in my case was empty. Given my programming background, I found this to be hilarious. (Admittedly, no one else did.)

By the way, I also find it amusing that ADC keeps track of us by PersonID. I am not a number, I am a person! Oh wait, I’m both.

One Response to “WordPress bug with post comment feeds”

  1. Kerk says:

    What is “PersonID”?