Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/323407

Change subject: HTMLFormFieldCloner: Don't try to validate hidden fields
......................................................................

HTMLFormFieldCloner: Don't try to validate hidden fields

Follow-up to 788526c2d1a4a9e32722c0a26b4a5027f00aa9bb.

To test: try to create a SecurePoll of type "Approval vote". Without this
patch, but with I81d04dca6cbb499a15828fd33b01746b68c694da, an invisible
field (only applicable for "Range voting (plurality)") will fail validation.

Change-Id: I37e50799ba1f0e0e64a197818b58444f5b056bf0
---
M includes/htmlform/fields/HTMLFormFieldCloner.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/07/323407/1

diff --git a/includes/htmlform/fields/HTMLFormFieldCloner.php 
b/includes/htmlform/fields/HTMLFormFieldCloner.php
index 5d8f491..09fe1bc 100644
--- a/includes/htmlform/fields/HTMLFormFieldCloner.php
+++ b/includes/htmlform/fields/HTMLFormFieldCloner.php
@@ -240,6 +240,9 @@
                                if ( !array_key_exists( $fieldname, $value ) ) {
                                        continue;
                                }
+                               if ( $field->isHidden( $alldata ) ) {
+                                       continue;
+                               }
                                $ok = $field->validate( $value[$fieldname], 
$alldata );
                                if ( $ok !== true ) {
                                        return false;

-- 
To view, visit https://gerrit.wikimedia.org/r/323407
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37e50799ba1f0e0e64a197818b58444f5b056bf0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to