From 056b6463080ce6669b28a8bbf7bdcb6ebb3168dc Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 19 Oct 2010 18:40:43 +0000 Subject: [PATCH] Followup r74988, brion wins again ;D --- includes/api/ApiBase.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 71e93090a6..df7ca1beeb 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -532,7 +532,7 @@ abstract class ApiBase { array_shift( $required ); $intersection = array_intersect( array_keys( array_filter( $params, - "validateParameter" ) ), $required ); + array( $this, "parameterNotEmpty" ) ) ), $required ); if ( count( $intersection ) > 1 ) { $this->dieUsage( 'The parameters ' . implode( ', ', $intersection ) . ' can not be used together', 'invalidparammix' ); @@ -541,7 +541,13 @@ abstract class ApiBase { } } - private function validateParameter( $x ) { + /** + * Callback function used in requireOnlyOneParameter to check whether reequired parameters are set + * + * @param $x object Parameter to check is not null/false + * @return bool + */ + private function parameterNotEmpty( $x ) { return !is_null( $x ) && $x !== false; } -- 2.20.1