My First Patch: Scott Reilly – coffee2code

Here is the next in the series of posts about your first patch and the experience of getting involved. I now hand you over to Scott “coffee2code” Reilly to talk about his first patch:

WordPress was already a quite capable blogging platform when I first got involved with it over six years ago. However, it wasn’t without significant issues. But unlike during my years using Movable Type, I was compelled to pitch in and help fix those issues. Maybe it was the active and friendly community. Maybe it was the palpable potential. Whatever the reason, from day one I’ve always felt the responsibility to contribute to and improve the project.

What specifically sparked my involvement with WordPress development were a number of formatting bugs. Turns out I wasn’t the only one experiencing these issues. After closer inspection and testing, I identified and provided examples of six bugs related to tag balancing:

  • User text gets irretrievably deleted
  • Insertion of non-sensical </> “tag”
  • Tags not getting balanced in certain situations (particularly when following an HTML comment)
  • Improper balancing of unclosed tags
  • Insertion of a close tag for <input />, which is a single-entity tag
  • Unclosed single-entity tags do not get closed

The most egregious being of course the possibility for WordPress to lose user content. The other issues resulted in broken tag semantics and validation, as well as often causing browser rendering issues for pages.

The culprit for all the issues listed above was balanceTags() (now called force_balance_tags()). Since that bit of code can seem a bit hairy at first glance and requires some close analysis to understand what it’s doing and how it’s doing it, I decided to make a blog post to explain the changes I made.

The patch was officially applied by Matt to trunk about five months later, on January 6, 2005, in time for WordPress 1.5.

Oddly enough, I just recently found myself again contributing a patch that involved modification of force_balance_tags().

I’m pleased to have been a part of WordPress for so long and to have contributed directly to core or indirectly via plugins. Most of all I’m pleased to have seen WordPress grow and help so many people in so many ways.

Note: My first patch applied to core was actually for #113, applied in [1519] by Ryan on August 8, 2004.

Editors Note: Please let me know if you would like to share your experiences writing your first patch for the core of WordPress.

About Peter Westwood

Happiness Gardener, Coder, Cat Herder, Bug Tracker, Cook and Code Dreamer
This entry was posted in My first patch and tagged , . Bookmark the permalink.