Setup :

  • 2 languages (EN as main, FR as translation)
  • Localization by String Translation
  • Expose webform component strings suitable for translation checked
  • Keep a single webform across a translation set. checked
  • Redirection location : Confirmation page - this is important, because if you set it to something else, you cannot see the bug

After posting a form in FR, you have an error in webform_localization_webform_submission_load(&$submissions) because there is no submission, so the Query condition $query->condition('s.sid', array_keys($submissions), 'IN'); blows up.
So here is a simple patch that returns if no submissions

Comments

rv0’s picture

I had the same error multi-page forms in 7.x-1.x when "saving a draft between pages"
patch does not fix it (well, it fixes the error, but does not target the problem)
fixed with #2007756: Unable to save draft between pages on a multipage webform using a single form across the translation set

coleman.sean.c’s picture

Status: Needs review » Reviewed & tested by the community

Ran into this bug by calling webform_get_submission() from my module code. Any time you attempt to get a non-existent submission, webform_localization_webform_submission_load() gets passed an empty array, and fatals. I can confirm that the patch fixes this issue.

rv0’s picture

Status: Reviewed & tested by the community » Needs work

@coleman.sean.c
please try the patch in the linked issue in #1
the patch here does not target the problem.

coleman.sean.c’s picture

Title: webform_localization_webform_submission_load error » webform_localization_webform_submission_load fatals on empty $submissions
Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.59 KB

Respectfully, the problem you describe in the other thread is unrelated to this issue, although they have similar symptoms. I've done some more thorough testing, and found that this patch addresses the bug, and the patch in the other issue does not.

To isolate this particular bug, from a stock Drupal install with the minimal profile, enable webform, and a module that does the following:

function foo_init() {
  module_load_include('inc', 'webform', 'includes/webform.submissions');
  webform_get_submission(1000, 1000);
}

With just webform, the 'minimal' profile, and the dependencies for webform_localization, webform_get_submission() returns FALSE, and the page loads.

With webform_localization enabled, the page crashes.

With webform_localization enabled and the patch from #2007756-1: Unable to save draft between pages on a multipage webform using a single form across the translation set applied, the page still crashes.

With webform_localization enabled and the patch from this issue applied, the page loads correctly.

I've attached my test module if anyone wants to replicate my results.

rv0’s picture

edit: nvm

this patch wil indeed fix your issue (though not the one this thread is about, but it wont do any harm to have this code in there)

rajab natshah’s picture

Thanks :)

GDrupal’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

I'm not being able to replicate this issue, seems to me that looking into current webform code the submissions array should never be empty in first place. Anyway the patch will do any harm ;) , thanks you all guys.

Status: Fixed » Closed (fixed)

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