Mark on WordPress

WordPress puts food on my table.

Hello Dolly Bug

with 6 comments

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.

Written by Mark Jaquith

July 24, 2007 at 4:08 am

6 Responses

Subscribe to comments with RSS.

  1. That’s too funny! And the look on Matt’s face when you said it was priceless!

    Charles Stricklin

    July 24, 2007 at 12:01 pm

  2. That is awesome! Your bug limerick holds a special place in my heart! That was a big clue that I was working and playing with the right people.

    Lloyd Budd

    July 24, 2007 at 6:13 pm

  3. 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. :-)

    Mark Jaquith

    July 25, 2007 at 6:08 pm

  4. Agreed! I think a nice patch with a clean Mark J experience for the 3rd option will convince teh Matt.

    Lloyd Budd

    July 25, 2007 at 11:46 pm

  5. 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

    Phil Wallach

    July 26, 2007 at 8:04 am

  6. Phil, arrays start at 0, so the first argument of mt_rand() should be 0. You’d only get a -1 index if the range given included -1.

    Mark Jaquith

    August 3, 2007 at 9:58 pm


Leave a Reply