The evil that is whitespace

The evil that is whitespace, a forum discussion on Jojo CMS. Join us for more discussions on The evil that is whitespace on our General Discussion forum.

Back to Forum Index : Back to General Discussion   RSS
Harvey

Core Developer

Harvey

4 Aug 2007
Posts: 327

I have been working hard on putting some new features into the forums the past couple of days. I was hoping to release the following features today...
  • RSS feeds for forum topics
  • Email notifications for topic replies
  • A few bug fixes


On my development server I thought I was doing pretty good, until I uploaded live a few minutes ago. This is where it gets fun.

Turns out the XML feeds don't validate (and don't work) due to a line of whitespace. Probably the same line of whitespace causing redirects to fail when you subscribe to a topic or edit a post.

I post this message publicly to illustrate the sorts of things that can go wrong when you let whitespace into your PHP files. I'm guessing this whitespace is included in a plugin that my dev server doesn't have, so the treasure hunt begins now.

Moral of the story:
Make sure your PHP files don't have leading or trailing whitespace.
Harvey

Core Developer

Harvey

4 Aug 2007
Posts: 327

And it looks like I found the nasty little culprit.

Hiding away in a plugin, I find a not-quite-empty placeholder file (pictured below). Watch out for these in future.
mikec

Lead Developer

mikec

6 Aug 2007
Posts: 67

The joys of windows file endings.

Please, everyone working on the jojo code, configure your text editors to:
- Use unix file endings (\n)
- Strip trailing whitespace on save
- Use soft tabs (4 spaces, not \t's)
- UTF-8 encoding
The jedit whitespace plugin does most of this. Not sure about other editors.

- Mike
Back to Forum Index : Back to General Discussion   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.