Does drupal_add_css not load duplicate filenames by design? If I try to add a css file using drupal_add_css to a custom module where there is already a css file loaded with the same name elsewhere (in my case in the theme, based on Zen), the module version does not load at all. Nothing to do with overriding styles - the two files contain completely different style information. If I change the filename in the custom module to something else which does not conflict, it loads correctly.

The question is is this by design? If not, is it a known bug? In my opinion this should not happen as a module developer has no idea what css files will be called in any custom theme.
Looking at the drupal_add_css() function, it seems this behaviour is by design.

For any CSS that you add using the function without using 'inline' as an argument, the array of files is keyed by the first argument (string) that you pass in. So if you were to run:

drupal_add_css('file.css');


And another module has also called drupal_add_css() with the same file name, the original will be overwritten.

As Marius Illie mentions in a comment above, the best way to avoid this is to prefix any CSS files you add with your module name.