X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLForm.php;h=71ccaa36e57c381e40addce6fd1dae214fc12fda;hb=ce079cf6ad79ca8d3360817f809b219d166f9153;hp=1f4d99ef661949bd9169eda8fe61a6cfedca7717;hpb=7c6d2a0fa28746b49d79345b609d9c7605ed4d63;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 1f4d99ef66..71ccaa36e5 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -147,6 +147,7 @@ class HTMLForm extends ContextSource { 'namespaceselect' => 'HTMLSelectNamespace', 'namespaceselectwithbutton' => 'HTMLSelectNamespaceWithButton', 'tagfilter' => 'HTMLTagFilter', + 'sizefilter' => 'HTMLSizeFilterField', 'submit' => 'HTMLSubmitField', 'hidden' => 'HTMLHiddenField', 'edittools' => 'HTMLEditTools', @@ -603,10 +604,14 @@ class HTMLForm extends ContextSource { */ public function trySubmit() { $valid = true; - $hoistedErrors = []; - $hoistedErrors[] = isset( $this->mValidationErrorMessage ) - ? $this->mValidationErrorMessage - : [ 'htmlform-invalid-input' ]; + $hoistedErrors = Status::newGood(); + if ( $this->mValidationErrorMessage ) { + foreach ( (array)$this->mValidationErrorMessage as $error ) { + call_user_func_array( [ $hoistedErrors, 'fatal' ], $error ); + } + } else { + $hoistedErrors->fatal( 'htmlform-invalid-input' ); + } $this->mWasSubmitted = true; @@ -633,15 +638,16 @@ class HTMLForm extends ContextSource { if ( $res !== true ) { $valid = false; if ( $res !== false && !$field->canDisplayErrors() ) { - $hoistedErrors[] = [ 'rawmessage', $res ]; + if ( is_string( $res ) ) { + $hoistedErrors->fatal( 'rawmessage', $res ); + } else { + $hoistedErrors->fatal( $res ); + } } } } if ( !$valid ) { - if ( count( $hoistedErrors ) === 1 ) { - $hoistedErrors = $hoistedErrors[0]; - } return $hoistedErrors; }