ajax_render() uses array_merge_recursive() to merge the JS settings, as opposed to drupal_array_merge_deep_array() used in drupal_get_js(). When a module (mistakenly?) adds the same settings object twice or more (seen in Openlayers), ajax_render() fails to merge duplicate values for the same keys, producing arrays instead. This is different from drupal_get_js(), which correctly merges duplicate values into one.

The attached patch fixes the issue.

CommentFileSizeAuthor
ajax_render_js_settings_merging.patch611 bytesjamix

Comments

wim leers’s picture

fabianx’s picture

Status: Needs review » Reviewed & tested by the community

RTBC, looks good to me.

Merging should be consistent.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, ajax_render_js_settings_merging.patch, failed testing.

jamix’s picture

Looks like this is no longer valid as both drupal_get_js() and ajax_render() use drupal_array_merge_deep_array() now.

fabianx’s picture

Status: Needs work » Closed (duplicate)

I think this is fixed then :). Please re-open if that is not the case! :)

lotyrin’s picture

Status: Closed (duplicate) » Active

This is still an issue in 7. drupal_get_js() calls drupal_array_merge_deep_array() where ajax_render calls array_merge_recursive();

lotyrin’s picture

lotyrin’s picture

Status: Closed (duplicate) » Needs review

Status: Needs review » Needs work

The last submitted patch, ajax_render_js_settings_merging.patch, failed testing.

David_Rothstein’s picture

Status: Needs work » Closed (duplicate)