Closed (fixed)
Project:
Webform
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Mar 2012 at 04:06 UTC
Updated:
24 Mar 2012 at 06:10 UTC
Jump to comment: Most recent file
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.