Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After adding a number component to a form, the Results -> Analysis tab throws 2 PHP notices per number component:
Notice: Undefined variable: average in _webform_analysis_number() (line 403 of /Users/nate/Sites/drupal7/sites/all/modules/webform/components/number.inc).
Notice: Undefined variable: average_title in _webform_analysis_number() (line 410 of /Users/nate/Sites/drupal7/sites/all/modules/webform/components/number.inc).
Comment | File | Size | Author |
---|---|---|---|
#1 | webform_number_analysis_notices.patch | 2.69 KB | quicksketch |
Comments
Comment #1
quicksketchThis patch corrects the problem by always executing the conditionals for "Average and population count", even if there aren't any values. This sets the variables for $average and $average_title. To avoid divide-by-zero errors, I added an extra check before calculating the averages.
Comment #2
quicksketchOh, this patch also solves the "User entered value" being inaccurate, since a user making a submission is not the same as submitting a value if they left the field blank.
Comment #3
quicksketchCommitted to both branches.