I'm trying to download a CSV for a webform that has no submissions, but the download hangs forever and I get thousands of warnings in the watchdog log:

Warning: Division by zero in webform_results_batch_rows() (line 1140 of sites/all/modules/webform/includes/webform.report.inc). 

The same happens when downloading only new submissions for a webform that has no new submissions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Paul B’s picture

Issue summary: View changes
quicksketch’s picture

Title: division by zero in webform.report.inc » Division by zero in webform.report.inc when downloading empty exports

Thanks for opening this issue.

I'm trying to download a CSV for a webform that has no submissions, but the download hangs forever and I get thousands of warnings in the watchdog log:

Just curious, is there a reason why your wanted/needed to download a CSV for a webform with no submissions?

DanChadwick’s picture

Version: 7.x-4.0-beta1 » 7.x-4.x-dev
Priority: Normal » Minor
Status: Active » Needs review
FileSize
1.55 KB

Here's a patch. I searched the source for ' / ' and fixed another issue with degenerate webforms with no components, resulting in a divide by zero in calculating submission export batch size.

Note that while the divide by zero is fixed, no output file is created, which creates a little weirdness after the export completes. Firefox gives a file-not-found message. I didn't try other browsers.

Paul B’s picture

Quicksketch: no reason.
The patch in #3 seems to fix the divide-by-zero. I also get the file-not-found message.

DanChadwick’s picture

Version: 7.x-4.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)
Issue tags: +backport

Committed to 7.x-4.x.

Needs backport to 7.x-3.x and 6.x

fenstrat’s picture

Version: 7.x-3.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed a01d3a9 to 8.x-4.x. Thanks!

Given @quicksketch's recent comments on back porting to the 3.x branches and 7.x-4.x reaching stability I don't think this needs back porting.

  • Commit 86e6c31 on 8.x-4.x authored by DanChadwick, committed by fenstrat:
    Issue #2203877 by DanChadwick: Division by zero in webform.report.inc...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.