3

Very early on I was putting together my first database-driven web app and decided to use record IDs with leading zeroes - you know, because that would look neater. It was a long, long time before I came to know that a number with a leading zero would be evaluated as octal, which in turn meant that any number with an 8 or a 9 in it was invalid, which then meant it would be a match for any other invalid number and retrieve a seemingly random record.

Comments
  • 1
    Is that also why you chose wk301 instead of wk321?
  • 1
    What kind of insane database interprets a number with a leading zero as octal and then treats all invalid numbers as equal to each other?!

    I know that programming languages do that octal thing but they also forbid entering invalid numbers during compilation.
  • 2
    @LensFlare database-driven web app !== database.
  • 1
    @spongegeoff I see. So I assume your problem was a direct consequence of JS’s lack of static checks.
Add Comment