database: Add extra sanity check to selectFieldValues()
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 16 Feb 2016 21:42:34 +0000 (13:42 -0800)
committerKrinkle <krinklemail@gmail.com>
Thu, 18 Feb 2016 14:38:44 +0000 (14:38 +0000)
Change-Id: Ia2788ea84bd099550655930188365984e5274678

includes/db/Database.php

index ef4a7b7..98473a5 100644 (file)
@@ -1069,7 +1069,9 @@ abstract class DatabaseBase implements IDatabase {
                $table, $var, $cond = '', $fname = __METHOD__, $options = array(), $join_conds = array()
        ) {
                if ( $var === '*' ) { // sanity
-                       throw new DBUnexpectedError( $this, "Cannot use a * field: got '$var'" );
+                       throw new DBUnexpectedError( $this, "Cannot use a * field" );
+               } elseif ( !is_string( $var ) ) { // sanity
+                       throw new DBUnexpectedError( $this, "Cannot use an array of fields" );
                }
 
                if ( !is_array( $options ) ) {