--- bootstrap.inc.orig 2008-06-17 21:06:35.000000000 -0500 +++ bootstrap.inc 2008-06-17 20:58:44.000000000 -0500 @@ -433,8 +433,31 @@ array("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value)) ); - $conf[$name] = $value; - cache_set('variables', 'cache', $conf); + if (!is_array($conf)) { + // Something is horribly wrong. Log what we can. + $file = tempnam('', 'drc'); + $fp = fopen($file, 'w'); + $temp = func_get_args(); + fwrite($fp, "Function args:\n" . print_r($temp, TRUE)); + fwrite($fp, "\n------------------------------\n"); + $temp = error_get_last(); + fwrite($fp, "Last error:\n" . print_r($temp, TRUE)); + fwrite($fp, "\n------------------------------\n"); + $temp = debug_backtrace(); + fwrite($fp, "Backtrace:\n" . print_r($temp, TRUE)); + fwrite($fp, "\n------------------------------\n"); + fwrite($fp, "Current state of conf array:\n" . print_r($conf, TRUE)); + fwrite($fp, "\n------------------------------\n"); + fflush($fp); + fwrite($fp, "Globals:\n" . print_r($GLOBALS, TRUE)); + fwrite($fp, "\n------------------------------\n"); + fclose($fp); + watchdog('debug', "Configuration went missing in variable_set! Info was dumped to $file.", WATCHDOG_ERROR); + } + else { + $conf[$name] = $value; + cache_set('variables', 'cache', $conf); + } } /**