From 62c45d54a4b889fbbd2c20bc82b2987573e493ec Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 5 Apr 2018 13:49:55 -0700 Subject: [PATCH] rdbms: move assertOpen() call near the top of Database::query This should be done before bothering with begin() calls or setting the value of fields like "trxDoneWrites" or "lastWriteTime". Change-Id: Ieace2870f5496fcf230c5c8381baca4b8038db1d --- includes/libs/rdbms/database/Database.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index b3957117dc..d7336c11f6 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1061,6 +1061,9 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware public function query( $sql, $fname = __METHOD__, $tempIgnore = false ) { $this->assertTransactionStatus( $sql, $fname ); + # Avoid fatals if close() was called + $this->assertOpen(); + $priorWritesPending = $this->writesOrCallbacksPending(); $this->lastQuery = $sql; @@ -1111,9 +1114,6 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->queryLogger->debug( "{$this->dbName} {$commentedSql}" ); } - # Avoid fatals if close() was called - $this->assertOpen(); - # Send the query to the server and fetch any corresponding errors $ret = $this->doProfiledQuery( $sql, $commentedSql, $isNonTempWrite, $fname ); $lastError = $this->lastError(); -- 2.20.1