From: Gergő Tisza Date: Mon, 2 May 2016 19:20:00 +0000 (+0000) Subject: Fix HTMLForm noData logic in trySubmit X-Git-Tag: 1.31.0-rc.0~7116^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%24wgLogo?a=commitdiff_plain;h=845bc5e77048da6ccf8159e79109e8efe112e68b;p=lhc%2Fweb%2Fwiklou.git Fix HTMLForm noData logic in trySubmit This was missed in If4e0dfb and causes missing array key warnings for fields using skipLoadData. Change-Id: Ib52ee2bc9af278f03b48730acc1edb30f5ff1f88 --- diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index d671029a25..9cad7bf68c 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -569,7 +569,7 @@ class HTMLForm extends ContextSource { # Check for cancelled submission foreach ( $this->mFlatFields as $fieldname => $field ) { - if ( !empty( $field->mParams['nodata'] ) ) { + if ( !array_key_exists( $fieldname, $this->mFieldData ) ) { continue; } if ( $field->cancelSubmit( $this->mFieldData[$fieldname], $this->mFieldData ) ) { @@ -580,7 +580,7 @@ class HTMLForm extends ContextSource { # Check for validation foreach ( $this->mFlatFields as $fieldname => $field ) { - if ( !empty( $field->mParams['nodata'] ) ) { + if ( !array_key_exists( $fieldname, $this->mFieldData ) ) { continue; } if ( $field->isHidden( $this->mFieldData ) ) { diff --git a/includes/htmlform/HTMLFormFieldCloner.php b/includes/htmlform/HTMLFormFieldCloner.php index 3f80884bff..ec1bd8427d 100644 --- a/includes/htmlform/HTMLFormFieldCloner.php +++ b/includes/htmlform/HTMLFormFieldCloner.php @@ -207,7 +207,7 @@ class HTMLFormFieldCloner extends HTMLFormField { foreach ( $values as $key => $value ) { $fields = $this->createFieldsForKey( $key ); foreach ( $fields as $fieldname => $field ) { - if ( !empty( $field->mParams['nodata'] ) ) { + if ( !array_key_exists( $fieldname, $value ) ) { continue; } if ( $field->cancelSubmit( $value[$fieldname], $alldata ) ) { @@ -237,7 +237,7 @@ class HTMLFormFieldCloner extends HTMLFormField { foreach ( $values as $key => $value ) { $fields = $this->createFieldsForKey( $key ); foreach ( $fields as $fieldname => $field ) { - if ( !empty( $field->mParams['nodata'] ) ) { + if ( !array_key_exists( $fieldname, $value ) ) { continue; } $ok = $field->validate( $value[$fieldname], $alldata );