API param validation: Set strict mode for in_array
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 2 Apr 2013 10:05:50 +0000 (12:05 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Tue, 2 Apr 2013 10:05:50 +0000 (12:05 +0200)
The in_array gives true when the allowed values contains a 0 as value,
for example by namespaces,

action=query&list=allpages&apnamespace=test|tset

was not rejected

Change-Id: I9220a955ffaf2bcb0d1d5b27c948af2f85714110

includes/api/ApiBase.php

index 741e908..84a6ed9 100644 (file)
@@ -1081,7 +1081,7 @@ abstract class ApiBase extends ContextSource {
 
                if ( !$allowMultiple && count( $valuesList ) != 1 ) {
                        // Bug 33482 - Allow entries with | in them for non-multiple values
-                       if ( in_array( $value, $allowedValues ) ) {
+                       if ( in_array( $value, $allowedValues, true ) ) {
                                return $value;
                        }