diff options
author | David Rothstein <drothstein@gmail.com> | 2013-04-01 17:33:47 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2013-04-01 17:33:47 -0400 |
commit | 005708cec562a368fb9b4cf997f034412b757360 (patch) | |
tree | b8bb777934cffbcd056a1f89b2c9a9d98a18c766 /includes | |
parent | 8104ea72c28c1a78fe039f2a9f918d724b9ab545 (diff) | |
download | brdo-005708cec562a368fb9b4cf997f034412b757360.tar.gz brdo-005708cec562a368fb9b4cf997f034412b757360.tar.bz2 |
Issue #1575060 by Spleshka, andypost, serm, mcjim, nod_: Fixed ajax_html_ids() are broken for forms with file element (encoding=multipart/form-data).
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc index f6171cfd9..3e6d31f88 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3878,7 +3878,16 @@ function drupal_html_id($id) { // requested id. $_POST['ajax_html_ids'] contains the ids as they were // returned by this function, potentially with the appended counter, so // we parse that to reconstruct the $seen_ids array. - foreach ($_POST['ajax_html_ids'] as $seen_id) { + if (is_array($_POST['ajax_html_ids'])) { + $ajax_html_ids = $_POST['ajax_html_ids']; + } + else { + // jquery.form.js may send the server a comma-separated string instead + // of an array (see http://drupal.org/node/1575060), so we need to + // convert it to an array in that case. + $ajax_html_ids = explode(',', $_POST['ajax_html_ids']); + } + foreach ($ajax_html_ids as $seen_id) { // We rely on '--' being used solely for separating a base id from the // counter, which this function ensures when returning an id. $parts = explode('--', $seen_id, 2); |