From c85bf31cf35f051e54f5e4548315550dcfa90ecc Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 19 Oct 2010 00:44:28 +0000 Subject: [PATCH] Swap usage of create_function for defined function as a callback --- includes/api/ApiBase.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 18dfb98f29..71e93090a6 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -532,8 +532,8 @@ abstract class ApiBase { array_shift( $required ); $intersection = array_intersect( array_keys( array_filter( $params, - create_function( '$x', 'return !is_null($x) && $x !== false;' ) - ) ), $required ); + "validateParameter" ) ), $required ); + if ( count( $intersection ) > 1 ) { $this->dieUsage( 'The parameters ' . implode( ', ', $intersection ) . ' can not be used together', 'invalidparammix' ); } elseif ( count( $intersection ) == 0 ) { @@ -541,6 +541,10 @@ abstract class ApiBase { } } + private function validateParameter( $x ) { + return !is_null( $x ) && $x !== false; + } + /** * @deprecated use MWNamespace::getValidNamespaces() */ -- 2.20.1