Warning: min(): Array must contain at least one element in webform_download_latest_start_sid() (line 1897 of webform/includes/webform.report.inc).

How to reproduce:
1. Create webform
2. Go to 'Results' > 'Download'
3. Select 'Download range options' > 'Only the latest _ submissions'
4. Enter a very high number in the text field and press 'Download'

Comments

tessa bakker’s picture

Issue summary: View changes
StatusFileSize
new1.19 KB

And the patch

tessa bakker’s picture

Status: Active » Needs review
tessa bakker’s picture

StatusFileSize
new1.44 KB

Different approach, different patch

danchadwick’s picture

StatusFileSize
new865 bytes

@Tessa Bakker -

I can't reproduce the issue as you've described it, but I do see two problems:

  1. If the latest submission query returns no results, you get the min() error. This should be fixed by testing the query results before using min.
  2. If the various query specs aren't valid, you can get PDO database errors by trying to see if the query worked. You are addressing that with the !form_get_errors &&

How does requesting a huge number of submissions cause an issue?

tessa bakker’s picture

Status: Needs review » Reviewed & tested by the community

Got the error with testing Webform 4.8 with a webform without results.

But patch #4 works and looks a lot better :)

  • DanChadwick committed d446dd2 on 7.x-4.x
    Issue #2487411 by Tessa Bakker, DanChadwick: Download latest submission...

  • DanChadwick committed ecb03d0 on
    Issue #2487411 by Tessa Bakker, DanChadwick: Download latest submission...
danchadwick’s picture

Title: Download of results with 'latest' range higher than max submissions results in php error » Download of results with 'latest' range with no submissions results in php error
Status: Reviewed & tested by the community » Fixed

Ah. I understand now.

#4 committed to 7.x-4.x and 8.x. Thanks for your help, Tessa Bakker.

Status: Fixed » Closed (fixed)

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