Inside of system.module, in the system_menu() hook, we have the following foreach loop. This loop is used to add a settings page for each theme. Here are lines 645 to 654 from system.module:
foreach (list_themes() as $theme) {
$items['admin/appearance/settings/' . $theme->name] = array(
'title' => $theme->info['name'],
'page arguments' => array('system_theme_settings', $theme->name),
'type' => MENU_LOCAL_TASK,
'access callback' => '_system_themes_access',
'access arguments' => array($theme),
'file' => 'system.admin.inc',
);
}
The list_themes() function feeds this foreach loop. But, if any theme has an empty .info file, or if the "name" parameter is missing from the .info file, a problem occurs. When this happens, $theme->info['name'] will be NULL in the above loop. The effect of this is as follows:
When _menu_router_save() tries to save the settings page for this theme, the 'title' value will be NULL and a PDOException will be thrown. This is the error thrown from _menu_router_save():
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be nulll: INSERT INTO {menu_router} (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, delivery_callback, fit, number_parts, context, tab_parent, tab_root, title, title_callback, title_arguments, theme_callback, theme_arguments, type, description, position, weight, include_file) VALUES ( [...] ) in _menu_router_save() (line 3837 of /includes/menu.inc).
In normal circumstances, there should never be a theme without a name in its .info file, but it happened to me accidentally and it was very hard to troubleshoot.
Themes without names should either be excluded from list_themes(), or the theme folder name should be used as the default theme name.