Shotgun Debugging Drupal

Like most developers I run a localhost version of the websites that I support live, but have many versions of the CMS databases copied down from LIVE over time.

Today while installing a new module I encountered this familiar error (Okay, technically it’s a notice):

Notice: unserialize() [function.unserialize]: Error at offset 0 of 32 bytes in [site-root]/includes/bootstrap.inc on line 478

Hmmm. Cryptic.

Here’s the joy of localhost debugging:

  • open /includes/bootstrap.inc
  • add code to dump the variables in the well-named variable table

var_dump($variable);

and hey-presto, you can read off the variable that the system is unhappy with.

Delete it with phpMyAdmin and remove the hack, job done.

Who needs a debugger?