Skip to content

Commit

Permalink
Allow any casting done in Type::validate to bubble up to Request::ret…
Browse files Browse the repository at this point in the history
…rieveValue

The validate function returns
- NULL if the passed in value is not valid
- THe passed in value if valid or
 - The passed in value cast to an integer if the value is valid and the type is Int or Integer

By always using the returned value we allow it to be cast, where appropriate
  • Loading branch information
eileenmcnaughton committed Feb 13, 2020
1 parent 7ae610d commit 8ae17a2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions CRM/Utils/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ public static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $d
break;
}

if (isset($value) &&
(CRM_Utils_Type::validate($value, $type, $abort, $name) === NULL)
) {
$value = NULL;
if (isset($value)) {
$value = CRM_Utils_Type::validate($value, $type, $abort, $name);
}

if (!isset($value) && $store) {
Expand Down

0 comments on commit 8ae17a2

Please sign in to comment.