From 6ab57b9c2424d9cc01b29908658b273a6ce75489 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 21 Mar 2019 16:17:25 -0700 Subject: [PATCH] rdbms: restrict more unsafe IDatabase methods in DBConnRef Change-Id: I1933da825e6b20b4ec742e0aa39d63e9a75f9a1c --- includes/libs/rdbms/database/DBConnRef.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/libs/rdbms/database/DBConnRef.php b/includes/libs/rdbms/database/DBConnRef.php index 4fdac81e66..5d80f836fc 100644 --- a/includes/libs/rdbms/database/DBConnRef.php +++ b/includes/libs/rdbms/database/DBConnRef.php @@ -74,11 +74,13 @@ class DBConnRef implements IDatabase { } public function tablePrefix( $prefix = null ) { - return $this->__call( __FUNCTION__, func_get_args() ); + // Disallow things that might confuse the LoadBalancer tracking + throw new DBUnexpectedError( $this, "Database selection is disallowed to enable reuse." ); } public function dbSchema( $schema = null ) { - return $this->__call( __FUNCTION__, func_get_args() ); + // Disallow things that might confuse the LoadBalancer tracking + throw new DBUnexpectedError( $this, "Database selection is disallowed to enable reuse." ); } public function getLBInfo( $name = null ) { @@ -86,11 +88,13 @@ class DBConnRef implements IDatabase { } public function setLBInfo( $name, $value = null ) { - return $this->__call( __FUNCTION__, func_get_args() ); + // Disallow things that might confuse the LoadBalancer tracking + throw new DBUnexpectedError( $this, "Changing LB info is disallowed to enable reuse." ); } public function setLazyMasterHandle( IDatabase $conn ) { - return $this->__call( __FUNCTION__, func_get_args() ); + // Disallow things that might confuse the LoadBalancer tracking + throw new DBUnexpectedError( $this, "Database injection is disallowed to enable reuse." ); } public function implicitGroupby() { -- 2.20.1