Skip to content

Instantly share code, notes, and snippets.

@gabrielmansour
Created November 27, 2013 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmansour/7681781 to your computer and use it in GitHub Desktop.
Save gabrielmansour/7681781 to your computer and use it in GitHub Desktop.
Identify any unserialization issues in Drupal to we can resolve them
#!/usr/bin/env drush
# Once it prints the faulty variable names, just re-set the values using `drush vset {variable_name} "{value}"
$variables = db_query('SELECT name, value FROM {variable}')->fetchAllKeyed();
foreach ($variables as $key => $val) {
$v = unserialize($val);
if ($v === FALSE && $val !== 'b:0;') {
print "Error unserializing '$key' (val = $val )\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment