Index: trunk/extensions/Validator/Validator.class.php |
— | — | @@ -329,7 +329,10 @@ |
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
333 | | - * Valides the provided parameter by matching the value against the list and item criteria for the name. |
| 333 | + * Valides the provided parameter. |
| 334 | + * |
| 335 | + * This method itself validates the list criteria, if any. After this the regular criteria |
| 336 | + * are validated by calling the doItemValidation method. |
334 | 337 | * |
335 | 338 | * @param string $name |
336 | 339 | * |
— | — | @@ -348,7 +351,7 @@ |
349 | 352 | // Get the validation function. If there is no matching function, throw an exception. |
350 | 353 | if ( array_key_exists( $criteriaName, self::$mListValidationFunctions ) ) { |
351 | 354 | $validationFunction = self::$mListValidationFunctions[$criteriaName]; |
352 | | - $isValid = $this->doCriteriaValidation( $validationFunction, $value, array(), $criteriaArgs ); |
| 355 | + $isValid = $this->doCriteriaValidation( $validationFunction, $value, $this->mParameters[$name], $criteriaArgs ); |
353 | 356 | |
354 | 357 | // Add a new error when the validation failed, and break the loop if errors for one parameter should not be accumulated. |
355 | 358 | if ( ! $isValid ) { |
— | — | @@ -398,7 +401,7 @@ |
399 | 402 | |
400 | 403 | // Loop through all the items in the parameter value, and validate them. |
401 | 404 | foreach ( $value as $item ) { |
402 | | - $isValid = $this->doCriteriaValidation( $validationFunction, $item, array(), $criteriaArgs ); |
| 405 | + $isValid = $this->doCriteriaValidation( $validationFunction, $item, $this->mParameters[$name], $criteriaArgs ); |
403 | 406 | if ( $isValid ) { |
404 | 407 | // If per item validation is on, store the valid items, so only these can be returned by Validator. |
405 | 408 | if ( self::$perItemValidation ) $validItems[] = $item; |
— | — | @@ -429,7 +432,7 @@ |
430 | 433 | } |
431 | 434 | else { |
432 | 435 | // Determine if the value is valid for single valued parameters. |
433 | | - $isValid = $this->doCriteriaValidation( $validationFunction, $value, array(), $criteriaArgs ); |
| 436 | + $isValid = $this->doCriteriaValidation( $validationFunction, $value, $this->mParameters[$name], $criteriaArgs ); |
434 | 437 | } |
435 | 438 | |
436 | 439 | // Add a new error when the validation failed, and break the loop if errors for one parameter should not be accumulated. |
— | — | @@ -462,6 +465,7 @@ |
463 | 466 | */ |
464 | 467 | private function doCriteriaValidation( $validationFunction, $value, array $metaData, array $criteriaArgs ) { |
465 | 468 | // Call the validation function and store the result. |
| 469 | + //var_dump($metaData);exit; |
466 | 470 | return call_user_func_array( $validationFunction, array_merge( array_merge( array( $value ), $metaData), $criteriaArgs ) ); |
467 | 471 | } |
468 | 472 | |