cakephp/cakephp — pull request #531 by RabidFire (2012-02-27 17:08:53+00:00)
Title: Fix class => file mapping for Plugins

App::load() would potentially map a class which is in a Plugin folder to the app folder (or vice versa) if they have the same name.

A valid use case for having classes with similar names in both the plugin and the app folder would be an API. Eg. UsersController (/users) and Api.UsersController (/api/users).

Since the mapping is cached to cake_core_file_map, once a mapping happens incorrectly, it does not get rectified on subsequent dispatches.

The fix ensures that the $plugin variable is passed along so that classes map correctly.