Drupal 7.27 introduced some changes in ajax.inc's ajax_form_callback() function regarding the #commands field in the $result array. The changes don't check if the field exists when merging it into the new value. This can lead to "undefined index" messages under certain circumstances.
I use webform_feedback together with webform_ajax to implement a global feedback form on a site. After upgrading to Drupal 7.27, I get the following notices and warnings after hitting the submit button:
Notice: Undefined index: #commands in ajax_form_callback() (line 404 of drupal/includes/ajax.inc).
Warning: array_merge(): Argument #2 is not an array in ajax_form_callback() (line 404 of drupal/includes/ajax.inc).
Warning: array_merge(): Argument #2 is not an array in ajax_render() (line 288 of drupal/includes/ajax.inc).
Warning: array_unshift() expects parameter 1 to be array, null given in ajax_render() (line 295 of drupal/includes/ajax.inc).
The form does not show the content it should (reloaded form, success message) after submitting, it stays as is.
With the provided patch, existence of #commands is checked and the form works again as it used to.
Comments
Comment #1
Christopher Herberte commentedPatch indeed fixed errors that were introduced with 7.27 and webform_ajax thanks :O
Comment #2
jannis commentedPatch fixed same errors from using 7.31 and webform ajax 7.x-1.1+2-dev
Comment #3
dcam commentedSetting the status so Testbot will pick it up.
Comment #5
pushpinderchauhan commentedRerolled above patch as it unable to apply.
Comment #6
jannis commenteder.pushpinderrana your patch applied perfectly. thanks
Comment #7
adamzimmermann commentedThe patch in #5 worked perfectly for me also. Thanks.
Comment #8
adamzimmermann commentedThe patch in #5 worked perfectly for me also. Thanks.
Comment #9
jannis commentedjust ran this patch on 7.34 fixed the same problem that's been in each release since 7.27. This patch needs to be committed
Comment #13
vadim.hirbu commentedJust updated latest patch.