Index: trunk/extensions/Validator/includes/Validator.php |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | |
190 | 190 | } |
191 | 191 | else { // If the parameter is not found in the list of allowed ones, add an item to the $this->mErrors array. |
192 | | - $this->registerError( |
| 192 | + $this->registerNewError( |
193 | 193 | wfMsgExt( |
194 | 194 | 'validator_error_unknown_argument', |
195 | 195 | 'parsemag', |
— | — | @@ -209,16 +209,27 @@ |
210 | 210 | * @param mixed $tags string or array |
211 | 211 | * @param integer $severity |
212 | 212 | */ |
213 | | - protected function registerError( $message, $tags = array(), $severity = ValidatorError::SEVERITY_NORMAL ) { |
214 | | - $error = new ValidatorError( |
215 | | - $message, |
216 | | - $severity, |
217 | | - $this->element, |
218 | | - (array)$tags |
| 213 | + protected function registerNewError( $message, $tags = array(), $severity = ValidatorError::SEVERITY_NORMAL ) { |
| 214 | + $this->registerError( |
| 215 | + new ValidatorError( |
| 216 | + $message, |
| 217 | + $severity, |
| 218 | + $this->element, |
| 219 | + (array)$tags |
| 220 | + ) |
219 | 221 | ); |
220 | | - |
| 222 | + } |
| 223 | + |
| 224 | + /** |
| 225 | + * Registers an error. |
| 226 | + * |
| 227 | + * @since 0.4 |
| 228 | + * |
| 229 | + * @param ValidationError $error |
| 230 | + */ |
| 231 | + protected function registerError( ValidatorError $error ) { |
221 | 232 | $this->errors[] = $error; |
222 | | - ValidatorErrorHandler::addError( $error ); |
| 233 | + ValidatorErrorHandler::addError( $error ); |
223 | 234 | } |
224 | 235 | |
225 | 236 | /** |
— | — | @@ -279,7 +290,9 @@ |
280 | 291 | $parameter = $this->parameters[$paramName]; |
281 | 292 | |
282 | 293 | if ( !$parameter->validate() ) { |
283 | | - $this->errors = array_merge( $this->errors, $parameter->getErrors() ); |
| 294 | + foreach ( $parameter->getErrors() as $error ) { |
| 295 | + $this->registerError( $error ); |
| 296 | + } |
284 | 297 | } |
285 | 298 | } |
286 | 299 | } |