From: Bartosz DziewoƄski Date: Thu, 24 Nov 2016 16:42:29 +0000 (+0100) Subject: HTMLFormFieldCloner: Don't try to validate hidden fields X-Git-Tag: 1.31.0-rc.0~4522^2~1 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=ae99e6724355dac31083206c96a7b2a2ef0d755b;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/htmlform/fields/HTMLFormFieldCloner.php b/includes/htmlform/fields/HTMLFormFieldCloner.php index 5d8f491881..09fe1bc6ab 100644 --- a/includes/htmlform/fields/HTMLFormFieldCloner.php +++ b/includes/htmlform/fields/HTMLFormFieldCloner.php @@ -240,6 +240,9 @@ class HTMLFormFieldCloner extends HTMLFormField { if ( !array_key_exists( $fieldname, $value ) ) { continue; } + if ( $field->isHidden( $alldata ) ) { + continue; + } $ok = $field->validate( $value[$fieldname], $alldata ); if ( $ok !== true ) { return false;