joomla/joomla-cms — pull request #5428 by mbabker (2014-12-14 16:46:22+00:00)
Title: Improvements to ClassLoaderJoomla

### Summary

To get around some B/C issues with using Composer's autoloader, we created a fork of the full `Composer\Autoload\ClassLoader` class and modified its `loadClass()` method to hook into Joomla's own autoloader.

### Issues

1) A complete fork of the class is not necessary for the single method call. We should be able to safely extend Composer's `ClassLoader` and just override the method we need to. From my testing, this is possible and works without issue.

2) If you have packages installed via a Composer global installation, for example `composer global require phpunit/phpunit` (to install PHPUnit globally instead of a per-project dependency), executing those global scripts on the Joomla installation fails due to a redeclared class (`ClassLoader`) and function (`includeFile`). Now that our loader is extending `ClassLoader`, we can make our class wise and only import the class/file included with Joomla if another script has already imported `ClassLoader`.

### Testing Instructions

Within the CMS, testing is simple - Apply the patch :smile:

If you have packages Composer packages globally installed and are executing those on a Joomla installation, pre-patch you should get a failure due to the redeclared class/function. Post-patch, scripts should function properly.