diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index f01a3de..c22a48d 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -983,7 +983,26 @@ function variable_initialize($conf = array()) { } else { // Proceed with variable rebuild. - $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')->fetchAllKeyed()); + $variables = array(); + // We can run into unparsable values + $err_variables = array(); + $rows = db_query('SELECT name, value FROM {variable}')->fetchAllKeyed(); + foreach ($rows as $name => $db_value) { + // Suppress the notice. + $value = @unserialize($db_value); + // If the unserialize call returned FALSE and the stored value is NOT a + // boolean FALSE, list it in the report. + if ($value === FALSE && $db_value !== serialize(FALSE) && !isset($conf[$name])) { + $err_variables[] = $name; + } + $variables[$name] = $value; + } + // We throw an exception before storing the variables otherwise + // this exception is only thrown once which is bad + if (count($err_variables)) { + $err_variables = join (", ", $err_variables); + throw new Exception("Cannot unserialize variables $err_variables. Check your database or hotfix through settings.php"); + } cache('bootstrap')->set('variables', $variables); lock_release($name); }