How expensive is an anti-pattern?

This one really got my goat today…

I was trying to figure out why file_transfer wasn’t sending the headers I was passing in after upgrading my module from D6 to D7.

Turns out that the function signature for the function which sends headers had changed, and decided that instead of taking a serial array, it now takes an associative array. That’s fine and all, but it did something I see commonly in Drupal which makes my blood boil.

It does nothing.

No error, no warning, nothing. In fact, the function drupal_add_http_header($name, $value) actually returns you a list of headers already added if you don’t pass in the name. Imagine all the disk space saved by not creating a function called drupal_get_http_headers! errr….

http://drupal.org/node/732486


Originally published at http://www.jacobsingh.name on March 4, 2010.

Jacob Singh
CTO in residence at Sequoia Capital. Independent product and Engineering Coach Mediocre guitarist, singer, rock climber, point guard and baker Dedicated dad. American in New Delhi.
New Delhi