joomla/joomla-platform — pull request #1760 by garyamort (2012-12-16 16:30:53+00:00)
Title: Jloader prefix

Codefix
====
Fixes loadByPrefix autoloader[_load] so that it doesn't give up on the first match.
Ex
====
Prefix: Tree, Path stubs/tree
Prefix: TreeLeaf, Path stubs/tree/leaf
class_exists(TreeLeafLeaf)

Current behavior
====
Will try to load either file stubs/tree/leaf/leaf.php or stubs/tree/leaf/leaf/leaf,php - but not both. Which file is attempted depends on which Prefix was loaded last(?). Even if the first file does not exist, it will still be the only file attempted.

New behavior
====
Check to class_exists is made after loading and only if true will the autoloader return.

Unit Tests
====
Implemented testRegisterPrefix in order to add test for this codefix
Included regression test to ensure that for multiple matching prefixes, multiple files are included if required. This test should fail for older platform code and succeed on this code.

// Regression check that multiple matching prefixes can load multiple files
$this->assertTrue($fileTreeLeafLeafLoaded, 'Tests that included files not defining class do not abort load.');

All other tests should succeed regardless of Platform version.