From 3b547150d8b20341fd8a196363d1d1ce95af0754 Mon Sep 17 00:00:00 2001 From: Dayllan Maza Date: Thu, 28 Mar 2019 16:02:44 -0400 Subject: [PATCH] Fix invalid namespace restriction when js is disabled When JS is disabled on Special:Block you were able to specify any namespace as part of the namespace restrictions field. This patch rejects any virtual namespace submitted on that field Bug: T216831 Change-Id: If09c43e5f836e1fdd9438b856d7f44f434c29fe1 --- includes/htmlform/fields/HTMLNamespacesMultiselectField.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/htmlform/fields/HTMLNamespacesMultiselectField.php b/includes/htmlform/fields/HTMLNamespacesMultiselectField.php index 5ad1a4d979..bd492d101b 100644 --- a/includes/htmlform/fields/HTMLNamespacesMultiselectField.php +++ b/includes/htmlform/fields/HTMLNamespacesMultiselectField.php @@ -45,6 +45,10 @@ class HTMLNamespacesMultiselectField extends HTMLSelectNamespace { } foreach ( $namespaces as $namespace ) { + if ( $namespace < 0 ) { + return $this->msg( 'htmlform-select-badoption' ); + } + $result = parent::validate( $namespace, $alldata ); if ( $result !== true ) { return $result; -- 2.20.1