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.
The "More stats" link under the Results -> Analysis tab seems to have some kind of loop in it. After creating a form with a number component, and after submitting it once, this link results in the following error:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 35 bytes) in /Users/nate/Sites/webform.com/www/sites/all/modules/contrib/webform/components/number.inc on line 444
Comment | File | Size | Author |
---|---|---|---|
#1 | webform_number_infinite_loop.patch | 2.81 KB | quicksketch |
Comments
Comment #1
quicksketchClarifying the problem, this actually only occurs when you have already made submissions but left the fields blank. This results in the total value being "0", thus causing the standard deviation loop to add up a series of values that it assumes will be more than 0. In the event that all the submissions are blank (or 0), the standard deviation code gets stuck in a loop and PHP runs out of memory adding up a really, really big number.
This patch corrects the problem by making sure the $sum variable is greater than 0 before doing the computation. While fixing all the problems with zeros, I also found that decimals aren't handled quite right. We've got a bunch of checks for
if ($component['extra']['decimals'] != '')
, but they're unnecessary since _webform_number_format() can handle the decimal value being an empty string (it triggers "automatic" length display, showing zero to four decimals if needed).Comment #2
quicksketchCommitted to both branches.