Sunday, May 20, 2007

Spaced out variables

As Jane Austen might have put it:
'It is a truth universally acknowledged that a young variable name in possession of a whitespace must be want of a bug correction report.'
It's a no-brainer. Something no programmer would contemplate doing, even in their most caffeine-crazed moments. So, when I got a complaint about an option which wouldn't work for a particular entry, I did quite a bit of head scratching and tracing before I spotted the problem.

The option in question was a piece of html representing a checkbox. It was generated via php as part of a report. Its value was taken from a database table, and was used to generate a variable.

This one entry was a reference code which just happened to have a space in it...

A case of what you don't know can hurt you!


No comments: