I seem to be having an issue with downloading webform reports. I see the batch process occur, but when it redirects me to download the file I receive a white screen.

In the logs I am seeing the following errors:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'sid' cannot be null: INSERT INTO {webform_last_download} (nid, uid, sid, requested) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 25501 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => 1410275402 ) in webform_results_download() (line 1071 of /sites/all/modules/webform/includes/webform.report.inc).

Notice: Undefined index: last_sid in webform_results_batch_results() (line 1236 of /sites/all/modules/webform/includes/webform.report.inc).

Not sure if anyone else has experienced this...

Running Drupal 7.31 and webform 7.x-4.0

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

robdubparker’s picture

Priority: Major » Normal
DanChadwick’s picture

@rp121 -- Is this really a WSOD, or is it really a redirect to a file that wasn't created (file not found).

I was able to reproduce a problem (maybe the same problem?) by downloading all the submissions and then downloading the new submissions. Since there aren't any new submissions, the PDO exception happens and not file is created.

robdubparker’s picture

Thanks @DanChadwick. I believe it may be a combination of what you are describing... I initially get the whitescreen, but if I reload the browser (same url), it tells me the file cannot be found. I also noticed that this happens only to forms that don't have any submissions (which I believe you experienced as well). So, the good news is that forms which contain results seem to work fine.

DanChadwick’s picture

Title: WSOD when downloading reports » File Not Found when downloading but no submissions
DanChadwick’s picture

Version: 7.x-4.0 » 8.x-4.x-dev
Status: Active » Fixed
FileSize
4.15 KB

Committed to 7.x-4.x and 8.x.

Background. It is not easy to guarantee that the counts used to generate the form and enable options will be accurate when the form is actually submitted. Additional submissions may be added or deleted while the form is being presented to the administrator, or another user may download submissions. Therefore the code must handle range specifications where it turns out that no records match.

There are four related sub-issues here.

  1. The last-downloaded sid must not be recorded when there weren't any sids that actually matched (for whatever reason).
  2. When a list of sids is created, but empty, it should be used to generate an empty query, rather than resorting to all the submissions.
  3. When a list of sids is created, but empty, the query generated must be valid. This is accomplished by querying on sid=0 rather than sid IN (), which is invalid SQL.
  4. The batch processing must handing batches with no records.

The result is is a file with a header but no data, which alleviates the File Not Found.

  • DanChadwick committed 94cf7f0 on 7.x-4.x
    Issue #2335587 by DanChadwick: Fixed File Not Found when downloading but...
  • DanChadwick committed 934eff2 on 8.x-4.x
    Issue #2335587 by DanChadwick: Fixed File Not Found when downloading but...

Status: Fixed » Closed (fixed)

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

DanChadwick’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev