files[]=lib.php fails to autoload classes of different namespace? In my custom module, I've included a file using files[]=foo.php in the .info file. foo.php declares classes in a namespace.

Drupal does not seem to be autoloading this class: in my main module file $foo = new Foo\Bar(); causes a Class Not Found error.

Is this because Drupal 7's registry can't cope with namespaces?
Yes, Drupal 7 knows nothing of namespaces unfortunately (namespaces were only introduced in PHP 5.3 and D7 is compatible with earlier versions than that).

However, life gets infinitely better with the XAutoload module, which is PSR-0 compliant an thus knows all about namespaces.


  xautoload is a comprehensive and yet highly efficient PHP class loading suite.
  Most importantly, it provides Drupal-8-style PSR-0 autoloading for Drupal 7.


The latest release is even moving towards PSR-4 which is great news.

If you install that module you can remove all of the files[] references from your info files, as long as you follow the \Drupal\my_module namespacing pattern. Even if you don't, XAutoload has hooks to let you define your own patterns.