rdbms: avoid dbSchema() in Database::replaceLostConnection() and Database::__clone()
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 11 Jul 2019 01:21:51 +0000 (18:21 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 11 Jul 2019 01:53:22 +0000 (01:53 +0000)
Since dbSchema() always casts the result to a string, using this method
with a call to open() is broken if the RDBMs does not support DB schemas
and thus requires null

Follows-up 7911da9c6f (last week), which added the check in
DatabaseMysqlBase::open() check. Also follows fe0af6cad (last year),
which made dbSchema() consistently return string. Before that, an
implicit null was passed in from Database::factory for mysql, which hid
the class default of empty string.

Bug: T227708
Change-Id: I67207fbaa39c5cc3fe062077cc654f048090e009

includes/libs/rdbms/database/Database.php

index 894a262..91dc069 100644 (file)
@@ -4290,8 +4290,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                                $this->server,
                                $this->user,
                                $this->password,
-                               $this->getDBname(),
-                               $this->dbSchema(),
+                               $this->currentDomain->getDatabase(),
+                               $this->currentDomain->getSchema(),
                                $this->tablePrefix()
                        );
                        $this->lastPing = microtime( true );
@@ -4868,8 +4868,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                                $this->server,
                                $this->user,
                                $this->password,
-                               $this->getDBname(),
-                               $this->dbSchema(),
+                               $this->currentDomain->getDatabase(),
+                               $this->currentDomain->getSchema(),
                                $this->tablePrefix()
                        );
                        $this->lastPing = microtime( true );