Skip to content

Instantly share code, notes, and snippets.

@vensires
Created January 3, 2017 13:24
Show Gist options
  • Save vensires/42ab9b497b096dfb365b3d410cca52ea to your computer and use it in GitHub Desktop.
Save vensires/42ab9b497b096dfb365b3d410cca52ea to your computer and use it in GitHub Desktop.
A small script to help you fix the notice with a Drupal variable not being able to be properly unserialized. Make sure you have the devel module enabled for the dpm function used in the error handler.
<?php
set_error_handler(function($errno, $errstr, $errfile, $errline, $errcontext) {
dpm($errcontext);
});
$variables = db_query('SELECT name, value FROM {variable}')->fetchAllKeyed();
foreach($variables as $name => $values) {
$value = unserialize($values);
}
restore_error_handler();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment