Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webform-3217982
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
webform-3217982
Commits
57aa1a66
Commit
57aa1a66
authored
3 years ago
by
Liam Morland
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3206854
: Handle non-numeric parameters in webform_modulo()
Backport of
5e12e892
.
parent
d4c2c156
No related branches found
Branches containing commit
Tags
7.x-3.38
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/number.inc
+7
-0
7 additions, 0 deletions
components/number.inc
with
7 additions
and
0 deletions
components/number.inc
+
7
−
0
View file @
57aa1a66
...
...
@@ -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
));
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment