WordPress Trivia, Part 1

I say ‘Part 1’ with no intention to write Parts 2, 3… n.

A quick Google search for ‘how many lines of code in WordPress’ came up with squat. I came up with over 350,000:

Granted, that includes the readme and license, but given the size of this codebase, there has to be some cruft, right? While I was absentmindedly perusing wp-includes/functions.php the other day I stumbled across this gem:

So, that’s fun. Turns out, it’s not called anywhere else in the WordPress core. There are a number of functions that aren’t called anywhere else- 18, actually, based on getting every function definition in that file (protip: don’t parse like me):

… and hashing that out in Perl:

I also found another ancient function that mimics http_build_query() (guess what it’s called- hint: PHP developers love underscores), yet based on WP Trac won’t be removed until WordPress requires PHP 5.4 (which I would hazard a guess will come with WordPress 5.0). So, yay for cruft!

Also, I’d like to point out that WordPress’s use of portable hashes with the PHPass framework is really frustrating- mostly because their implementation of MD5 hash stretching uses binary output that’s difficult to recreate in JS (more on that in a later post). Andrew Moore does a great job of explaining how portable PHPass hashes are generated, and while there was a conversation last year about how WordPress should handle its PHPass implementation, it never seemed to go anywhere (shame, since that would actually have solved my problem- again, I’ll get there next week).

Leave a Reply

Your email address will not be published. Required fields are marked *