Hello Dolly Bug

It just now occurred to me that at WordCamp I joked that the happiest moment of my life was when I found a bug in “Hello Dolly,” the ultra-simple example plugin that has been bundled with WordPress for as long as I can remember. Correction: I committed the fix for the bug, but I wasn’t the one who found the bug. Chalk that down to fuzzy memory. In any case, that’s why we track these things. Here is the now legendary commit, and here is the report. Sorry for accidentally taking credit for that, “joti!”

Note the time difference between the report and the fix. Thirteen minutes. Nothing but the best for our precious Dolly!

The bug existed because numerically indexed arrays start at 0, not 1. So the number of the last element in an array is actually one less than the number of elements in that array.

6 thoughts on “Hello Dolly Bug

  1. Ha! @ Lloyd. Which reminds me… we still need to fix that bug. It’s a flippin’ shame that there’s no built-in way to always do full text feeds.

    And the look on Matt’s face when you said it was priceless!

    I caught that.🙂

  2. Perhaps I am missing something.

    Shouldn’t the fix be:

    $chosen = wptexturize( $lyrics[ mt_rand(1, count($lyrics) – 1) ] );

    Otherwise you could get a -1 index.

    Regards
    Phil

Comments are closed.