Download & Extend

Default download API behavior bugs

Project:Webform
Version:7.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I found two bugs while working with the download API related to defaults.

1. webform_results_download() defaults the $format argument to 'delimiter', while it should actually be 'delimited'. This manifests itself in webform_export_create_handler() attempting to instantiate webform_exporter_broken, which is obviously nonexistent.

2. webform_results_download() merges the values in array_keys($submission_information) and array_keys(webform_component_list($node, 'csv', TRUE)) with the + array operator, which merges in values according to keys. If the first array has the corresponding keys set, the second array key will not take effect. Since both use array_keys(), the resulting arrays will be numerically indexed, so the first 7 items in the second array will not be present in the output (since $submission_information has 7 items). I've had a form with less than 7 fields, so no custom field data was exported. This should use array_merge() instead which actually merges data from the two arrays instead of trying to overlap them. $submission_information has string keys, while the components are numbered, so no collisions should happen.

Simple patch attached.

AttachmentSize
webform-download-defaults-bug.patch1.37 KB

Comments

#1

Status:active» needs review

#2

Thanks Gábor. These look like they're needed for the 6.x version also.

#3

Status:needs review» fixed

Thanks, finally committed. Sorry for the delay.

#4

Status:fixed» closed (fixed)

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