Skip to content

Commit 25feeaf

Browse files
committed
Require DB_NAME to be set only in the new driver
1 parent 6fc6ad0 commit 25feeaf

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

wp-includes/sqlite/class-wp-sqlite-db.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ public function db_connect( $allow_bail = true ) {
307307
$pdo = $GLOBALS['@pdo'];
308308
}
309309
if ( defined( 'WP_SQLITE_AST_DRIVER' ) && WP_SQLITE_AST_DRIVER ) {
310+
if ( null === $this->dbname || '' === $this->dbname ) {
311+
$this->bail( 'The database name was not set.', 'db_connect_fail' );
312+
return false;
313+
}
314+
310315
require_once __DIR__ . '/../../wp-includes/parser/class-wp-parser-grammar.php';
311316
require_once __DIR__ . '/../../wp-includes/parser/class-wp-parser.php';
312317
require_once __DIR__ . '/../../wp-includes/parser/class-wp-parser-node.php';

wp-includes/sqlite/db.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@
6666
require_once $crosscheck_tests_file_path;
6767
$GLOBALS['wpdb'] = new WP_SQLite_Crosscheck_DB( DB_NAME );
6868
} else {
69-
$GLOBALS['wpdb'] = new WP_SQLite_DB( DB_NAME );
69+
$GLOBALS['wpdb'] = new WP_SQLite_DB( defined( 'DB_NAME' ) ? DB_NAME : '' );
7070
}

0 commit comments

Comments
 (0)