Skip to content
Snippets Groups Projects
Commit 57aa1a66 authored by Liam Morland's avatar Liam Morland
Browse files

Issue #3206854: Handle non-numeric parameters in webform_modulo()

Backport of 5e12e892.
parent d4c2c156
No related branches found
Tags 7.x-3.38
No related merge requests found
......@@ -820,5 +820,12 @@ function webform_number_standardize($value, $point) {
* See https://drupal.org/node/1601968.
*/
function webform_modulo($a, $b) {
// Ensure values are either int or float.
if (!is_numeric($a) || !is_numeric($b)) {
return 0.0;
}
$a = +$a;
$b = +$b;
return $a - $b * (($b < 0) ? ceil($a / $b) : floor($a / $b));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment