Permalink
Browse files

Fix issue with duplicate class inclusions.

When trying to load a class that shared a prefix with an existing
class on case insensitive file systems duplicate class errors could
occur.  This would happen primarily with models and missing model classes.

Fixes #2223
  • Loading branch information...
1 parent f4a0478 commit ccefe02de9d4cc462cdfc8a74158862d347afbac @markstory markstory committed Nov 13, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Cake/Core/App.php
View
@@ -523,12 +523,14 @@ public static function load($className) {
}
}
- //To help apps migrate to 2.0 old style file names are allowed
+ // To help apps migrate to 2.0 old style file names are allowed
+ // if the trailing segment is one of the types that changed, alternates will be tried.
foreach ($paths as $path) {
$underscored = Inflector::underscore($className);
$tries = array($path . $underscored . '.php');
$parts = explode('_', $underscored);
- if (count($parts) > 1) {
+ $numParts = count($parts);
+ if ($numParts > 1 && in_array($parts[$numParts - 1], array('behavior', 'helper', 'component'))) {
array_pop($parts);
$tries[] = $path . implode('_', $parts) . '.php';
}

0 comments on commit ccefe02

Please sign in to comment.