DBError expects IDatabase|null as its first argument
authorStephane Bisson <sbisson@wikimedia.org>
Tue, 1 Nov 2016 14:51:13 +0000 (10:51 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Tue, 1 Nov 2016 14:51:13 +0000 (10:51 -0400)
I came across LBFactory.php:357 while testing my
master/replica db setup. It was not configured correctly
and I got "Argument 1 passed to DBExpectedError::__construct()
must implement interface IDatabase, string given" instead
of the actual error.

Change-Id: I949e1803f84459f8bb83e957a88d1e927cad16f7

includes/libs/rdbms/exception/DBAccessError.php
includes/libs/rdbms/lbfactory/LBFactory.php

index c00082c..864dea0 100644 (file)
@@ -25,6 +25,6 @@
  */
 class DBAccessError extends DBUnexpectedError {
        public function __construct() {
-               parent::__construct( "Database access has been disabled." );
+               parent::__construct( null, "Database access has been disabled." );
        }
 }
index d21289b..4fb5b38 100644 (file)
@@ -355,6 +355,7 @@ abstract class LBFactory implements ILBFactory {
 
                if ( $failed ) {
                        throw new DBReplicationWaitError(
+                               null,
                                "Could not wait for replica DBs to catch up to " .
                                implode( ', ', $failed )
                        );