I upgraded to 5.x-1.2 and found that specifically in my case the admin_menu module sets the defer flag on its javascript when calling drupal_add_js. So when that js is part of a bundle, the whole bundle gets the defer flag set on its script which causes a few problems on our site.
Looks like the code in sf_cache_process_file_list changed and is causing the problem. Specifically:
if ($kind == 'js') {
$meta += array('cache' => TRUE, 'defer' => FALSE);
}
Assuming the purpose of that code is to make sure it always caches and never defers the scripts then you should be using array_merge. += on an array works the same as array_merge() but it does not override duplicate keys. So if there is already a defer = TRUE in there it will never be overwritten. Unless you wanted it to preserve the defer flag - but in that case you should really be checking to see that every file in the bundle has the defer flag.
Patch:
Index: sf_cache.module
===================================================================
--- sf_cache.module (revision 838)
+++ sf_cache.module (working copy)
@@ -260,7 +260,7 @@
// Add default values to meta.
// For CSS, $meta may currently only contain 'cc' => <conditional comments selector>
if ($kind == 'js') {
- $meta += array('cache' => TRUE, 'defer' => FALSE);
+ $meta = array_merge($meta, array('cache' => TRUE, 'defer' => FALSE));
}
// Add the aggregated file.
Comments
Comment #1
mr.j commentedSame patch against 6.x release.
Comment #2
mr.j commentedMarking reviewed and tested as I noticed this bugfix was not included in the latest dev release.
Comment #3
wim leersMoving to the Bundlecache issue queue, as per #962178: Rename/migrate to Bundlecache and provide a stable D6 release..