diff --git includes/bootstrap.inc includes/bootstrap.inc old mode 100644 new mode 100755 index e931dd7..8f5f96a --- includes/bootstrap.inc +++ includes/bootstrap.inc @@ -2676,6 +2676,37 @@ function _registry_check_code($type, $name = NULL) { return TRUE; } + // Skip classes and interfaces that belong to the database layer. These are + // already handled by the database's own autoload handler. Additionally, if we + // were to try and load these before the database is loaded and configured + // we end up with an infinite loop as we try to query the database to autoload + // the database driver, which would end very badly. + static $database_classes = array( + 'QueryPlaceholderInterface' => TRUE, + 'QueryConditionInterface' => TRUE, + 'DatabaseCondition' => TRUE, + 'Query' => TRUE, + 'DeleteQuery' => TRUE, + 'InsertQuery' => TRUE, + 'UpdateQuery' => TRUE, + 'MergeQuery' => TRUE, + 'TruncateQuery' => TRUE, + 'QueryAlterableInterface' => TRUE, + 'SelectQueryInterface' => TRUE, + 'SelectQuery' => TRUE, + 'SelectQueryExtender' => TRUE, + 'DatabaseConnection' => TRUE, + 'DatabaseLog' => TRUE, + 'DatabaseTransaction' => TRUE, + 'DatabaseStatementPrefetch' => TRUE, + 'DatabaseSchema' => TRUE, + ); + // Those can be optionally suffixed with the engine name, so we only consider + // the part of the name before the first underscore. + if (($type == 'class' || $type == 'interface') && isset($database_classes[strtok($name, '_')])) { + return TRUE; + } + if (!isset($lookup_cache)) { $lookup_cache = array(); if ($cache = cache_get('lookup_cache', 'cache_bootstrap')) { diff --git includes/database/database.inc includes/database/database.inc index 104d76f..a3d9b0e 100644 --- includes/database/database.inc +++ includes/database/database.inc @@ -2123,7 +2123,7 @@ function db_autoload($class) { 'QueryAlterableInterface', ), 'select.inc' => array('QueryAlterableInterface', 'SelectQueryInterface', 'SelectQuery', 'SelectQueryExtender'), - 'database.inc' => array('DatabaseConnection'), + 'database.inc' => array('DatabaseConnection', 'DatabaseTransaction'), 'log.inc' => array('DatabaseLog'), 'prefetch.inc' => array('DatabaseStatementPrefetch'), 'schema.inc' => array('DatabaseSchema'), diff --git includes/registry.inc includes/registry.inc index b0faf25..0432c5a 100644 --- includes/registry.inc +++ includes/registry.inc @@ -53,6 +53,9 @@ function _registry_update() { } } foreach (file_scan_directory('includes', '/\.inc$/') as $filename => $file) { + if (substr($filename, 0, 18) == 'includes/database/') { + continue; + } $files["$filename"] = array('module' => '', 'weight' => 0); }