From 26a4587d803632994f915700191067da8219cc99 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Mon, 15 Feb 2010 07:06:49 +0000 Subject: [PATCH] follow up r62353 Make ApiBase::requireOnlyOneParameter() accept parameters that are set, but false. This means that you can pass in more than one parameter, as long as it is the same as the default (false). Have to do it this way since we'd like to default boolean parameters to false in getAllowedParams() but by the time requireOnlyOneParameter() is called, the defaults are set, so we can't tell the difference between passing in a parameter set to the default and just getting the defaults. --- includes/api/ApiBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index a6a7a0a43b..ff54af1003 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -474,7 +474,7 @@ abstract class ApiBase { } /** - * Die if none or more than one of a certain set of parameters is set + * Die if none or more than one of a certain set of parameters is set and not false. * @param $params array of parameter names */ public function requireOnlyOneParameter( $params ) { @@ -482,7 +482,7 @@ abstract class ApiBase { array_shift( $required ); $intersection = array_intersect( array_keys( array_filter( $params, - create_function( '$x', 'return !is_null($x);' ) + create_function( '$x', 'return !is_null($x) && $x !== false;' ) ) ), $required ); if ( count( $intersection ) > 1 ) { $this->dieUsage( 'The parameters ' . implode( ', ', $intersection ) . ' can not be used together', 'invalidparammix' ); -- 2.20.1