Merge "ApiCSPReport: Log user ID instead of name, and limit urls to origin"
[lhc/web/wiklou.git] / includes / htmlform / fields / HTMLNamespacesMultiselectField.php
index 5ad1a4d..5eab605 100644 (file)
@@ -38,13 +38,15 @@ class HTMLNamespacesMultiselectField extends HTMLSelectNamespace {
                // $value is a string, because HTMLForm fields store their values as strings
                $namespaces = explode( "\n", $value );
 
-               if ( isset( $this->mParams['max'] ) ) {
-                       if ( count( $namespaces ) > $this->mParams['max'] ) {
-                               return $this->msg( 'htmlform-int-toohigh', $this->mParams['max'] );
-                       }
+               if ( isset( $this->mParams['max'] ) && ( count( $namespaces ) > $this->mParams['max'] ) ) {
+                       return $this->msg( 'htmlform-int-toohigh', $this->mParams['max'] );
                }
 
                foreach ( $namespaces as $namespace ) {
+                       if ( $namespace < 0 ) {
+                               return $this->msg( 'htmlform-select-badoption' );
+                       }
+
                        $result = parent::validate( $namespace, $alldata );
                        if ( $result !== true ) {
                                return $result;